The atoms system showcases interactive UI components and patterns with live demos, similar to shadcn/ui's component library. It uses fumadocs MDX with catch-all dynamic routing and provides a visual playground for reusable UI atoms.
content/atoms/ # Root atoms content directory
├── (root)/ # Main atom components
│ ├── meta.json # Navigation configuration
│ ├── index.mdx # Landing page
│ ├── accordion.mdx # Accordion component
│ ├── card.mdx # Card variations
│ ├── infinite-slider.mdx # Animation components
│ └── *.mdx # Individual atom docs
src/app/[lang]/(root)/atoms/ # Route handlers
├── [[...slug]]/ # Catch-all dynamic route
│ └── page.tsx # Atom page component
└── layout.tsx # Atoms layout with sidebar
src/components/docs/ # Atom components
├── atoms-sidebar.tsx # Static sidebar navigation
└── toc.tsx # Table of contents
src/lib/
├── source.ts # Atoms source loader
└── atoms-utils.ts # Helper utilities
content/atoms/(root)/ directory[[...slug]] handles all atom paths/atoms/[component-name]Create your .mdx file in content/atoms/(root)/:
---
title: "Your Component Name"
description: "Brief description of what this component does"
component: true
links:
doc: "https://docs.example.com/component"
api: "https://api.example.com/component"
---
# Component Overview
Brief introduction to your component.
## Demo
<ComponentPreview
align="start"
className="[&_.preview]:max-w-[80%]"
code={`import { YourComponent } from "@/components/ui/your-component"
export function YourComponentDemo() {
return (
<YourComponent>
Content here
</YourComponent>
)
}`}
>
<YourComponentDemo />
</ComponentPreview>
## Installation
\`\`\`bash
npm install your-component
\`\`\`
## Usage
\`\`\`tsx
import { YourComponent } from "@/components/ui/your-component"
export default function Example() {
return <YourComponent />
}
\`\`\`
## API Reference
### Props
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| variant | string | "default" | Visual style variant |
| size | string | "md" | Component size |Add your atom to the sidebar in src/components/docs/atoms-sidebar.tsx:
const ATOMS_LINKS = [
{ name: "Introduction", href: "/atoms" },
// Card Components
{ name: "Activity Goal", href: "/atoms/activity-goal" },
// ... existing links ...
// Add your new atom
{ name: "Your Component", href: "/atoms/your-component" },
]Update content/atoms/(root)/meta.json:
{
"title": "Atoms",
"pages": [
"index",
"accordion",
"your-component", // Add your atom here
// ... other atoms
]
}# Generate MDX files
pnpm fumadocs-mdx
# Run development server
pnpm dev
# Navigate to http://localhost:3000/atoms/your-componentInteractive card-based UI patterns:
Animation and interaction patterns:
AI-specific UI patterns:
Core UI building blocks:
The main feature for showcasing components:
<ComponentPreview
align="start" // Alignment: start, center, end
className="custom-class" // Custom styling
code={`// Your code here`} // Code to display
>
<ActualComponent /> // Live demo
</ComponentPreview>Syntax-highlighted code examples:
```tsx {1,3-5}
// Line 1 is highlighted
function Example() {
// Lines 3-5 are highlighted
return <div>Example</div>
}
```Show multiple installation methods:
<Tabs defaultValue="npm">
<TabsList>
<TabsTrigger value="npm">npm</TabsTrigger>
<TabsTrigger value="yarn">yarn</TabsTrigger>
<TabsTrigger value="pnpm">pnpm</TabsTrigger>
</TabsList>
<TabsContent value="npm">
npm install package
</TabsContent>
<TabsContent value="yarn">
yarn add package
</TabsContent>
<TabsContent value="pnpm">
pnpm add package
</TabsContent>
</Tabs>Document component APIs:
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| variant | "default" \| "outline" | "default" | Visual style |
| size | "sm" \| "md" \| "lg" | "md" | Component size |
| disabled | boolean | false | Disable interaction |1. Brief overview
2. Visual demo (ComponentPreview)
3. Installation instructions
4. Basic usage example
5. Props/API reference
6. Advanced examples (if needed)
7. Accessibility notes
8. Related components
Always include:
---
title: "Component Name" # Clear, concise name
description: "What it does" # One-line description
component: true # Marks as component doc
links: # Optional external links
doc: "https://..."
api: "https://..."
---To add sections to the sidebar, modify atoms-sidebar.tsx:
const ATOMS_LINKS = [
{ name: "Getting Started", href: "/atoms", separator: true },
// Section 1
{ name: "--- Card Components ---", disabled: true },
{ name: "Activity Goal", href: "/atoms/activity-goal" },
// Section 2
{ name: "--- Interactive ---", disabled: true },
{ name: "Accordion", href: "/atoms/accordion" },
]Atoms use consistent styling from docs:
max-w-2xl for contentWhen your atom requires packages:
pnpm add your-package## Installation
This component requires the following dependencies:
\`\`\`bash
pnpm add your-package
\`\`\`# Regenerate MDX
pnpm fumadocs-mdx
# Clear cache
rm -rf .next
pnpm buildatoms-sidebar.tsxmeta.jsonpnpm fumadocs-mdxFor interactive playgrounds:
<Playground
code={defaultCode}
scope={{ Button, Input }}
previewClassName="p-4"
/>Show multiple versions:
## Variants
<ComponentPreview code={variantDefault}>
<Button>Default</Button>
</ComponentPreview>
<ComponentPreview code={variantOutline}>
<Button variant="outline">Outline</Button>
</ComponentPreview>
<ComponentPreview code={variantGhost}>
<Button variant="ghost">Ghost</Button>
</ComponentPreview>Show responsive behavior:
<ComponentPreview
className="[&_.preview]:w-full"
code={responsiveCode}
>
<ResponsiveComponent />
</ComponentPreview>content/atoms/(root)/pnpm add fumadocs-mdx fumadocs-coreAtoms can be contributed via:
content/atoms/On This Page
Atoms FactoryOverviewArchitectureFile StructureHow It Works1. Content Processing2. Routing3. Navigation4. ComponentsHow to Add New AtomsStep 1: Create MDX FileStep 2: Update NavigationStep 3: Add meta.json EntryStep 4: Build and TestComponent CategoriesCard ComponentsInteractive AtomsAI ComponentsUI UtilitiesMDX FeaturesComponent PreviewCode BlocksInstallation TabsProps TablesBest Practices1. Component Organization2. Documentation Structure3. Demo Guidelines4. Frontmatter Standards5. Code ExamplesCustomizationCustom Sidebar SectionsStyling Atoms PagesAdding DependenciesTroubleshootingBuild ErrorsComponent Not RenderingNavigation Not UpdatingStyling IssuesAdvanced FeaturesLive Code EditingComponent VariantsResponsive DemosPerformanceOptimizationMetricsMigration GuideFrom Individual FilesAdding to Existing ProjectFuture EnhancementsPlanned FeaturesCommunity ContributionsResources