Tailgrids Documentation

repository·main·Indexed 23 days ago

https://github.com/tailgrids/tailgrids

An open-source React UI component library built with Tailwind CSS, featuring over 100 production-ready components and 500+ premium UI blocks. Includes a dedicated CLI for project initialization and component installation, an icon library (@tailgrids/icons), and a Model Context Protocol (MCP) server for AI coding assistants to search, retrieve source code, and scaffold UI sections.

Tokens
94.1K
Snippets
196
Records
500
Agent score
79%

What's inside Tailgrids

  1. Overview of Tailgrids features

    main

    Tailgrids is an open-source React UI component library powered by Tailwind CSS. Key features include:

    • 100+ free React components: Production-ready, TypeScript-first components.
    • Premium UI Blocks: 500+ sections for dashboards, marketing, e-commerce, and AI.
    • Tailwind CSS Powered: 100% customizable using utility classes.
    • Tailgrids CLI: Streamlined component installation.
    • Modern Design: Built-in accessibility (a11y), dark mode support, responsiveness, and keyboard navigation.
    • Lightweight: No heavy dependencies, optimized for performance.
  2. Overview of Tailgrids React Components

    main
    Tailgrids provides a library of over 100 production-ready React components built with Tailwind CSS. These components are designed to be free, open-source, and fully customizable. They follow a 'copy-paste friendly' pattern, allowing developers to easily integrate them into existing React Tailwind projects to accelerate development.
  3. Overview of Tailgrids MCP Server

    main
    The Tailgrids MCP (Model Context Protocol) server connects AI coding assistants (such as Claude Code, Cursor, or VS Code with Copilot) directly to the Tailgrids UI component library. It allows an AI agent to search through 600+ React Tailwind CSS components, fetch TSX source code, inspect props/variants, and scaffold UI sections directly within your development environment. This eliminates the need for manual documentation browsing or guessing Tailwind classes.
  4. What is Tailgrids MCP?

    main

    Tailgrids MCP is a Model Context Protocol (MCP) server that connects AI coding assistants (like Claude Code, Cursor, and VS Code with GitHub Copilot) directly to the Tailgrids React component library.

    It allows your AI agent to:

    • Search for components using natural language.
    • Retrieve raw TSX source code and usage examples.
    • Inspect TypeScript props and validate them against schemas.
    • Audit accessibility (a11y) and theming/styling configurations.
    • Scaffold full-page sections and UI compositions from plain English descriptions.
  5. How Sidebar components work together

    main

    The Sidebar system uses a provider-consumer pattern to manage state like collapsible modes, mobile viewports, and keyboard shortcuts (CMD + B / CTRL + B).

    Core Architecture

    • SidebarProvider: The root component that must wrap your application navigation. It manages the collapsible state and persistence.
    • Sidebar: The physical container that reacts to the provider's state to expand, collapse, or shrink into an icon-only view.
    • SidebarTrigger: A component used to toggle the sidebar's visibility or collapse state.

    Typical Layout Pattern

    Wrap your application shell in a SidebarProvider, place your Sidebar instance inside, and use a <main> container for the page content.

    import {
      SidebarProvider,
      SidebarTrigger
    } from "@/components/tailgrids/core/sidebar";
    import { AppSidebar } from "./app-sidebar";
    
    export default function Layout({ children }: { children: React.ReactNode }) {
      return (
        <SidebarProvider>
          {/* Renders your customized <Sidebar> component instance */}
          <AppSidebar />
          <main className="w-full flex-1">
            {/* Opens/Closes the sidebar on click */}
            <SidebarTrigger />
            {children}
          </main>
        </SidebarProvider>
      );
    }
  6. Accessibility features of the Time Picker

    main

    The Time Picker is built with accessibility in mind using react-aria patterns:

    • Keyboard Support: Navigate popover columns using Arrow keys and select values with Enter.
    • Screen Readers: Uses MenuTrigger and Popover roles for correct announcement of interactive elements.
    • Focus Management: Focus is automatically moved into the popover when opened and returned to the trigger upon selection or dismissal.
  7. How Tabs components work together

    main

    The Tabs component is composed of four main parts that must be nested within a TabRoot to function:

    1. TabRoot: The main container that manages the state of the active tab.
    2. TabList: A container for the navigation triggers.
    3. TabTrigger: The clickable buttons used to switch between views. Each trigger must have a unique value.
    4. TabContent: The panels containing the content. Each panel must have a value that matches a TabTrigger's value.

    Only the TabContent panel whose value matches the current active tab in TabRoot will be visible.

    import {
      TabRoot,
      TabList,
      TabTrigger,
      TabContent
    } from "@/components/tailgrids/core/tabs";
    
    const TabsExample = () => (
      <TabRoot defaultValue="tab1">
        <TabList>
          <TabTrigger value="tab1" />
          <TabTrigger value="tab2" />
        </TabList>
        <TabContent value="tab1" />
        <TabContent value="tab2" />
      </TabRoot>
    );
  8. Assemble the Scroll Area component

    main

    The Scroll Area is composed of three main parts: ScrollArea (the root), ScrollAreaViewport (the container for content), and ScrollBar (the interactive track/thumb). To create a functional scroll area, you must wrap your content in the viewport and place the scrollbars inside the root component.

    import {
      ScrollArea,
      ScrollAreaViewport,
      ScrollBar
    } from "@/components/scroll-area";
    
    export const ScrollAreaExample = () => (
      <ScrollArea>
        <ScrollAreaViewport>{/* Scrollable Content */}</ScrollAreaViewport>
        <ScrollBar orientation="vertical" />
        <ScrollBar orientation="horizontal" />
      </ScrollArea>
    );
  9. How Drawer components work together

    main

    The Drawer component follows a composable pattern. It uses a root Drawer component to manage state, a DrawerTrigger to initiate opening, and DrawerContent to define the panel's layout and behavior.

    Inside DrawerContent, you can compose several sub-components to build the UI:

    • DrawerHeader, DrawerTitle, and DrawerDescription for the top section.
    • DrawerBody for the main scrollable content.
    • DrawerFooter and DrawerClose for the bottom action area.

    This structure allows for flexible layouts while maintaining built-in support for drag gestures, animations, and accessibility.

    import {
      Drawer,
      DrawerTrigger,
      DrawerContent,
      DrawerHeader,
      DrawerTitle,
      DrawerDescription,
      DrawerBody,
      DrawerFooter,
      DrawerClose
    } from "@/components/tailgrids/core/drawer";
    
    export default function DrawerAnatomy() {
      return (
        <Drawer>
          <DrawerTrigger />
          <DrawerContent side="bottom">
            <DrawerHeader>
              <DrawerTitle />
              <DrawerDescription />
            </DrawerHeader>
            <DrawerBody />
            <DrawerFooter>
              <DrawerClose />
            </DrawerFooter>
          </DrawerContent>
        </Drawer>
      );
    }
  10. Accessibility features of Toggle

    main

    The Toggle component is designed with accessibility as a priority:

    • Native Support: Built on <input type="checkbox"> for native keyboard and screen reader support.
    • Keyboard Interaction: Use the Space key to toggle the switch when focused.
    • Semantic Association: Visible labels are associated via htmlFor and id.
    • Screen Reader Friendly: The input is visually hidden using sr-only but remains fully accessible to assistive technologies.
  11. Accessibility features of RangeCalendar

    main

    The RangeCalendar component provides robust accessibility support:

    • Keyboard navigation: Use arrow keys to move between days. Use Enter or Space to select a range. Hold Shift while navigating to extend the selection.
    • Screen reader support: Includes correct calendar roles, labels, and state announcements for range selection.
    • Selection announcements: Start and end dates are announced distinctly to clarify range boundaries.
    • Disabled vs Unavailable: Disabled dates cannot be focused or selected. Unavailable dates remain focusable but are blocked from selection.
    • Year navigation: The custom year picker integrates with the calendar state for seamless selection.