A custom documentation system for Elements, providing comprehensive provider documentation and component demos in a maintainable, in-house built solution.
- Custom MDX Documentation System - Built from scratch without fumadocs dependency
- Command+K Search - Fast search functionality across all docs and components
- Smart Table of Contents - Automatic TOC generation with scroll tracking
- Provider-Focused Structure - Organized by provider (Clerk, Stripe, AI SDK, etc.)
- Responsive Design - Mobile-first approach with beautiful UI
- Legacy Component Support - Backwards compatible with existing
/t
routes
src/
βββ app/
β βββ t/[[...slug]]/page.tsx # Main documentation routing system
β βββ globals.css # Global styles and theme configuration
β βββ page.tsx # Main landing page
βββ components/
β βββ command-search.tsx # Command+K search functionality
β βββ table-of-contents.tsx # Auto-generating TOC with scroll tracking
β βββ component-page-template.tsx # Reusable component page template
β βββ ui/ # shadcn/ui components
βββ content/ # MDX documentation files
β βββ ai-sdk.mdx # AI SDK provider documentation
β βββ stripe.mdx # Stripe provider documentation
β βββ [provider].mdx # Additional provider docs
βββ registry/ # Component registry
- Next.js 15 - React framework with App Router
- MDX - Markdown with JSX components (
@next/mdx
,next-mdx-remote
) - TypeScript - Type safety throughout
- Tailwind CSS - Styling with custom design system
- Remark/Rehype - Markdown processing with plugins
- CMDK - Command palette functionality
- Gray Matter - Frontmatter parsing
Create MDX files in src/content/
for each provider:
---
title: "Provider Name"
description: "Brief description of the provider and its components"
category: "CATEGORY NAME"
brandColor: "#000000"
darkBrandColor: "#ffffff"
icon: "π―"
installCommand: "bunx shadcn@latest add @elements/provider"
showRegistryVisualizer: true
layout:
type: "auto"
columns: 2
gap: "lg"
features:
- icon: "β¨"
title: "Feature Name"
description: "Feature description"
---
# Provider Documentation
Your comprehensive provider documentation goes here...
## Installation
```bash
npm install provider-package
Description and usage examples...
Real-world usage examples...
### Frontmatter Options
| Field | Type | Description |
|-------|------|-------------|
| `title` | `string` | Provider/component name |
| `description` | `string` | Brief description |
| `category` | `string` | Category for organization |
| `brandColor` | `string` | Primary brand color (hex) |
| `darkBrandColor` | `string` | Dark mode brand color (optional) |
| `icon` | `string` | Emoji or icon identifier |
| `installCommand` | `string` | Installation command |
| `showRegistryVisualizer` | `boolean` | Show component registry visualization |
| `layout.type` | `"auto" \| "custom"` | Layout type |
| `layout.columns` | `1 \| 2 \| 3 \| 4` | Number of columns |
| `layout.gap` | `"sm" \| "md" \| "lg"` | Grid gap size |
| `features` | `array` | List of key features |
## π Search Functionality
The Command+K search provides:
- **Global Search** - Search across all documentation
- **Categorized Results** - Organized by providers, components, and pages
- **Keyboard Navigation** - Full keyboard support
- **Smart Filtering** - Searches titles, descriptions, and categories
### Adding Search Items
Update `src/components/command-search.tsx` to include new documentation:
```typescript
const SEARCH_DATA: SearchItem[] = [
{
id: "new-provider",
title: "New Provider",
description: "Description of the new provider",
url: "/t/new-provider",
type: "provider",
category: "Integration",
},
// ... more items
];
The TOC component automatically:
- Scans Headings - Finds all h1-h6 elements with IDs
- Creates Navigation - Generates clickable navigation links
- Tracks Scroll - Highlights current section
- Smooth Scrolling - Smooth navigation to sections
Headings are automatically enhanced with anchor links via rehype-slug
and rehype-autolink-headings
.
The project uses a custom OKLCH color system:
/* Custom CSS variables in globals.css */
:root {
--primary: oklch(0.7 0.15 270);
--background: oklch(1 0 0);
/* ... more variables */
}
All components support custom styling:
<TableOfContents className="custom-toc-styles" />
<CommandSearch appearance={{ theme: 'custom' }} />
We've completely removed fumadocs dependencies and built a custom system:
-
Removed Dependencies:
fumadocs-core
fumadocs-mdx
fumadocs-ui
-
Added Dependencies:
@next/mdx
next-mdx-remote
gray-matter
remark-gfm
rehype-slug
rehype-autolink-headings
-
File Changes:
- Removed
src/app/docs/
directory - Removed
content/docs/
directory - Updated
next.config.ts
to use@next/mdx
- Created custom routing in
src/app/t/[[...slug]]/page.tsx
- Removed
The system maintains backwards compatibility with existing /t
routes:
/t/clerk
β Uses legacy component/t/new-provider
β Uses new MDX system- Automatic fallback to legacy routes when MDX not found
# Install dependencies
bun install
# Start development server
bun run dev
# Build for production
bun run build
# Run linting
bun run lint
# Run type checking
bun run typecheck
-
Create MDX File:
touch src/content/my-provider.mdx
-
Add Frontmatter and Content: Follow the frontmatter schema and write comprehensive documentation.
-
Update Search Index: Add the new provider to
SEARCH_DATA
incommand-search.tsx
. -
Test Routes: Visit
/t/my-provider
to see your documentation.
For interactive components, you can import them directly in MDX:
import { MyComponent } from '@/components/my-component';
# My Provider
<MyComponent prop="value" />
The MDX configuration in next.config.ts
:
const withMDX = createMDX({
options: {
remarkPlugins: [remarkGfm],
rehypePlugins: [
rehypeSlug,
[rehypeAutolinkHeadings, { behavior: 'wrap' }],
],
},
});
Customize search behavior in command-search.tsx
:
// Modify search logic, add new item types, or change categorization
const getIcon = (type: SearchItem["type"]) => {
// Custom icon logic
};
- Clear Structure - Use consistent heading hierarchy
- Code Examples - Include practical, runnable examples
- Installation Steps - Always provide clear installation instructions
- Error Handling - Document common issues and solutions
- Props Documentation - Use tables for component props
- Provider Focus - Organize by provider/service
- Logical Grouping - Group related components together
- Consistent Naming - Use kebab-case for file names
- Comprehensive Examples - Show real-world usage patterns
- Static Generation - MDX files are statically generated
- Code Splitting - Components are lazy-loaded when needed
- Search Optimization - Search data is optimized for fast filtering
- Image Optimization - Use Next.js Image component for assets
The system includes Vercel Analytics integration for tracking:
- Page views and navigation patterns
- Search usage and popular queries
- Component installation tracking
- User engagement metrics
- Fork the Repository
- Create Feature Branch:
git checkout -b feature/amazing-feature
- Write Documentation: Add comprehensive MDX documentation
- Update Search: Add new items to search index
- Test Thoroughly: Ensure all routes work correctly
- Submit Pull Request: Include screenshots and descriptions
- Add Elements registry to your
components.json
file:
{
"registries": {
"@elements": "https://tryelements.dev/r/{name}.json"
}
}
- Install any element you want using the
bunx shadcn@latest add
command.
bunx shadcn@latest add @elements/logos
Complete authentication flows with sign-in, sign-up, and waitlist components.
Popular brand logos collection with shopping cart functionality.
Dark/light mode toggles with multiple variants.
More coming soon...
Visit tryelements.dev to browse all components.
Built with β€οΈ by the Crafter Station team for the Elements ecosystem.