"use client"
import { useState, useMemo } from "react"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { Input } from "@/components/ui/input"
import { Badge } from "@/components/ui/badge"
import { Button } from "@/components/ui/button"
import { Switch } from "@/components/ui/switch"
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
import { Progress } from "@/components/ui/progress"
import { Slider } from "@/components/ui/slider"
import { Search, ExternalLink, Check } from "lucide-react"
import Link from "next/link"
// All components data with preview components
const allComponents = [
{
id: "accordion",
name: "Accordion",
description: "Collapsible content sections",
category: "Layout",
preview: (
Section 1
▼
Content here...
),
},
{
id: "alerts",
name: "Alert",
description: "Important messages and notifications",
category: "Feedback",
preview: (
),
},
{
id: "alert-dialog",
name: "Alert Dialog",
description: "Modal dialogs for critical actions",
category: "Overlay",
preview: (
Confirm Action
Are you sure?
),
},
{
id: "avatars",
name: "Avatar",
description: "User profile pictures and placeholders",
category: "Display",
preview: (
),
},
{
id: "badges",
name: "Badge",
description: "Small status indicators and labels",
category: "Display",
preview: (
New
Pro
Beta
Error
),
},
{
id: "breadcrumbs",
name: "Breadcrumb",
description: "Navigation hierarchy indicators",
category: "Navigation",
preview: (
Home
/
Products
/
Item
),
},
{
id: "buttons",
name: "Button",
description: "Interactive elements for actions",
category: "Input",
preview: (
Primary
Outline
Secondary
),
},
{
id: "calendar",
name: "Calendar",
description: "Date selection and display",
category: "Input",
preview: (
December 2024
{["S", "M", "T", "W", "T", "F", "S"].map((day, i) => (
{day}
))}
{Array.from({ length: 14 }, (_, i) => (
{i < 7 ? "" : i - 6}
))}
15
),
},
{
id: "cards",
name: "Card",
description: "Flexible content containers",
category: "Layout",
preview: (
Card Title
Card description here
Content goes here...
),
},
{
id: "checkbox",
name: "Checkbox",
description: "Binary choice input controls",
category: "Input",
preview: (
),
},
{
id: "collapsible",
name: "Collapsible",
description: "Expandable content sections",
category: "Layout",
preview: (
),
},
{
id: "combobox",
name: "Combobox",
description: "Searchable dropdown selections",
category: "Input",
preview: (
),
},
{
id: "command",
name: "Command",
description: "Command palette interface",
category: "Navigation",
preview: (
Type a command...
Create new file
Open settings
Search files
),
},
{
id: "context-menu",
name: "Context Menu",
description: "Right-click contextual menus",
category: "Overlay",
preview: (
),
},
{
id: "dropdowns",
name: "Dropdown",
description: "Selection menus and options",
category: "Input",
preview: (
Options ▼
Option 1
Option 2
Option 3
),
},
{
id: "forms",
name: "Form",
description: "Data input and validation",
category: "Input",
preview: (
),
},
{
id: "hover-card",
name: "Hover Card",
description: "Content preview on hover",
category: "Overlay",
preview: (
),
},
{
id: "label",
name: "Label",
description: "Form field labels and descriptions",
category: "Input",
preview: (
Field Label
Input field
Helper text
),
},
{
id: "modals",
name: "Modal",
description: "Overlay dialogs and popups",
category: "Overlay",
preview: (
Modal Title
Modal content goes here...
Cancel
Save
),
},
{
id: "pagination",
name: "Pagination",
description: "Navigate through pages of content",
category: "Navigation",
preview: (
←
1
2
3
→
),
},
{
id: "progress",
name: "Progress",
description: "Task completion indicators",
category: "Feedback",
preview: (
Loading... 65%
Processing files
),
},
{
id: "scroll-area",
name: "Scroll Area",
description: "Custom scrollable containers",
category: "Layout",
preview: (
Item 1
Item 2
Item 3
Item 4
Item 5
),
},
{
id: "sheet",
name: "Sheet",
description: "Slide-out panels and drawers",
category: "Overlay",
preview: (
Sheet Title
Content here...
),
},
{
id: "sidebar",
name: "Sidebar",
description: "Navigation and content panels",
category: "Layout",
preview: (
),
},
{
id: "skeleton",
name: "Skeleton",
description: "Loading state placeholders",
category: "Feedback",
preview: (
),
},
{
id: "slider",
name: "Slider",
description: "Range input controls",
category: "Input",
preview: (
),
},
{
id: "switch",
name: "Switch",
description: "Toggle controls for binary states",
category: "Input",
preview: (
),
},
{
id: "tabs",
name: "Tab",
description: "Organize content in tabbed interfaces",
category: "Navigation",
preview: (
),
},
{
id: "tables",
name: "Table",
description: "Structured data display",
category: "Display",
preview: (
Name | Status
John | Active
Jane | Pending
Bob | Inactive
),
},
{
id: "top-navigation",
name: "Top Navigation",
description: "Header navigation bars",
category: "Navigation",
preview: (
),
},
{
id: "tooltips",
name: "Tooltip",
description: "Contextual help and information",
category: "Overlay",
preview: (
),
},
]
const categories = ["All", "Input", "Display", "Layout", "Navigation", "Overlay", "Feedback"]
export function ComponentsGallerySection() {
const [searchTerm, setSearchTerm] = useState("")
const [selectedCategory, setSelectedCategory] = useState("All")
const filteredComponents = useMemo(() => {
return allComponents.filter((component) => {
const matchesSearch =
component.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
component.description.toLowerCase().includes(searchTerm.toLowerCase())
const matchesCategory = selectedCategory === "All" || component.category === selectedCategory
return matchesSearch && matchesCategory
})
}, [searchTerm, selectedCategory])
return (
{/* Header */}
Components
A comprehensive collection of reusable UI components built with React, TypeScript, and Tailwind CSS. Each
component is designed with accessibility, customization, and developer experience in mind.
{/* Search and Filter */}
{/* Results count */}
{filteredComponents.length} component{filteredComponents.length !== 1 ? "s" : ""} found
{/* Components Grid */}
{filteredComponents.map((component) => (
{component.name}
{component.category}
{/* Component Preview */}
{component.preview}
{component.description}
))}
{/* No results */}
{filteredComponents.length === 0 && (
No components found
Try adjusting your search or filter criteria
{
setSearchTerm("")
setSelectedCategory("All")
}}
>
Clear filters
)}
)
}