UI Components Library
Overview
The UI components library is built on Radix UI primitives with custom styling using Tailwind CSS. All components are located in src/components/ui/.
Component List
Form Components
Button (button.tsx)
Styled button component with variants.
Variants:
default,destructive,outline,secondary,ghost,link
Sizes:
default,sm,lg,icon
Input (input.tsx)
Text input component with styling.
Features:
- Standard HTML input props
- Consistent styling
- Disabled state support
Textarea (textarea.tsx)
Multi-line text input component.
Features:
- Auto-resize option
- Standard HTML textarea props
Label (label.tsx)
Form label component.
Usage:
<Label htmlFor="email">Email</Label>
<Input id="email" />Checkbox (checkbox.tsx)
Checkbox input component.
Features:
- Controlled/uncontrolled modes
- Indeterminate state support
Radio Group (radio-group.tsx)
Radio button group component.
Features:
- Single selection
- Controlled value
Select (select.tsx)
Dropdown select component.
Features:
- Searchable option
- Multi-select support
- Custom option rendering
Layout Components
Card (card.tsx)
Card container component.
Sub-components:
CardHeader: Card header sectionCardTitle: Card titleCardDescription: Card descriptionCardContent: Card main contentCardFooter: Card footer section
Usage:
<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardContent>Content</CardContent>
<CardFooter>Footer</CardFooter>
</Card>Separator (separator.tsx)
Visual separator component.
Orientations:
horizontal(default)vertical
Scroll Area (scroll-area.tsx)
Custom scrollable container.
Features:
- Custom scrollbar styling
- Smooth scrolling
Navigation Components
Sidebar (sidebar.tsx)
Collapsible sidebar component.
Sub-components:
SidebarProvider: Context providerSidebar: Main sidebar containerSidebarHeader: Sidebar headerSidebarContent: Sidebar content areaSidebarFooter: Sidebar footerSidebarMenu: Menu containerSidebarMenuItem: Menu itemSidebarMenuButton: Menu buttonSidebarInset: Main content area
Features:
- Collapsible (icon-only mode)
- Responsive
- Keyboard navigation
Breadcrumb (breadcrumb.tsx)
Breadcrumb navigation component.
Usage:
<Breadcrumb>
<BreadcrumbList>
<BreadcrumbItem>
<BreadcrumbLink href="/">Home</BreadcrumbLink>
</BreadcrumbItem>
<BreadcrumbSeparator />
<BreadcrumbItem>Current</BreadcrumbItem>
</BreadcrumbList>
</Breadcrumb>Tabs (tabs.tsx)
Tab navigation component.
Sub-components:
TabsList: Tab list containerTabsTrigger: Individual tab triggerTabsContent: Tab content panel
Usage:
<Tabs defaultValue="tab1">
<TabsList>
<TabsTrigger value="tab1">Tab 1</TabsTrigger>
<TabsTrigger value="tab2">Tab 2</TabsTrigger>
</TabsList>
<TabsContent value="tab1">Content 1</TabsContent>
<TabsContent value="tab2">Content 2</TabsContent>
</Tabs>Overlay Components
Dialog (dialog.tsx)
Modal dialog component.
Sub-components:
DialogTrigger: Button to open dialogDialogContent: Dialog content containerDialogHeader: Dialog headerDialogTitle: Dialog titleDialogDescription: Dialog descriptionDialogFooter: Dialog footer
Usage:
<Dialog>
<DialogTrigger>Open</DialogTrigger>
<DialogContent>
<DialogHeader>
<DialogTitle>Title</DialogTitle>
<DialogDescription>Description</DialogDescription>
</DialogHeader>
Content
<DialogFooter>
<Button>Close</Button>
</DialogFooter>
</DialogContent>
</Dialog>Drawer (drawer.tsx)
Slide-out drawer component (mobile-friendly).
Features:
- Slide from bottom/side
- Backdrop overlay
- Close on backdrop click
Sheet (sheet.tsx)
Sheet component (similar to drawer).
Features:
- Slide from side
- Multiple sizes
- Responsive behavior
Tooltip (tooltip.tsx)
Tooltip component.
Usage:
<Tooltip>
<TooltipTrigger>Hover me</TooltipTrigger>
<TooltipContent>Tooltip text</TooltipContent>
</Tooltip>Data Display Components
Table (table.tsx)
Table component.
Sub-components:
Table: Table containerTableHeader: Header row containerTableBody: Body containerTableFooter: Footer row containerTableRow: Table rowTableHead: Header cellTableCell: Data cell
Usage:
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Email</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>John</TableCell>
<TableCell>john@example.com</TableCell>
</TableRow>
</TableBody>
</Table>Badge (badge.tsx)
Badge component for labels and status indicators.
Variants:
default,secondary,destructive,outline
Usage:
<Badge variant="default">New</Badge>
<Badge variant="destructive">Error</Badge>Avatar (avatar.tsx)
Avatar component for user images.
Sub-components:
AvatarImage: Avatar imageAvatarFallback: Fallback text/icon
Usage:
<Avatar>
<AvatarImage src="/avatar.jpg" />
<AvatarFallback>JD</AvatarFallback>
</Avatar>Skeleton (skeleton.tsx)
Loading skeleton component.
Usage:
<Skeleton className="h-4 w-[250px]" />Interactive Components
Dropdown Menu (dropdown-menu.tsx)
Dropdown menu component.
Sub-components:
DropdownMenuTrigger: Trigger buttonDropdownMenuContent: Menu contentDropdownMenuItem: Menu itemDropdownMenuSeparator: SeparatorDropdownMenuLabel: Menu labelDropdownMenuCheckboxItem: Checkbox itemDropdownMenuRadioGroup: Radio group
Toggle (toggle.tsx)
Toggle button component.
Features:
- Pressed/unpressed states
- Variants:
default,outline
Toggle Group (toggle-group.tsx)
Group of toggle buttons.
Types:
single: Single selectionmultiple: Multiple selection
Utility Components
Pagination (pagination.tsx)
Pagination component.
Sub-components:
PaginationList: Page number listPaginationItem: Page number itemPaginationLink: Page linkPaginationPrevious: Previous buttonPaginationNext: Next buttonPaginationEllipsis: Ellipsis indicator
Search Input (search-input.tsx)
Search input with icon.
Features:
- Search icon
- Clear button
- Debounced input (optional)
Sortable Table Header (sortable-table-header.tsx)
Table header with sorting functionality.
Features:
- Sort indicators
- Click to sort
- Sort direction (asc/desc)
Stepper (stepper.tsx)
Multi-step form component.
Features:
- Step indicators
- Active step highlighting
- Step validation
Notification Components
Sonner (sonner.tsx)
Toast notification component (wrapper for Sonner library).
Usage:
import { toast } from "sonner";
toast.success("Success message");
toast.error("Error message");
toast.info("Info message");Chart Components
Chart (chart.tsx)
Chart component wrapper (for Recharts).
Features:
- Configurable chart types
- Responsive sizing
- Customizable styling
Styling
All components use Tailwind CSS for styling with:
- Consistent color scheme
- Dark mode support (via
next-themes) - Responsive design
- Accessibility features
Usage Best Practices
- Import components individually to optimize bundle size
- Use TypeScript for type safety
- Follow component composition patterns for complex UIs
- Leverage sub-components for flexible layouts
- Use variants for different visual styles
- Handle loading and error states appropriately