Introduction
Fumadocs provides two UI packages for building beautiful documentation sites with different component primitives:fumadocs-ui
The primary UI package built with Radix UI primitives, providing a complete set of accessible, customizable components.Installation
Features
- Radix UI Primitives: Built on battle-tested @radix-ui components
- Three Layout Options: Choose between docs, flux, and notebook layouts
- Fully Styled: Pre-styled components with Tailwind CSS
- Accessible: WCAG compliant with keyboard navigation and screen reader support
- Customizable: Extensive theming with CSS variables
- TypeScript: Full type safety with TypeScript definitions
Package Exports
@fumadocs/base-ui
An alternative UI package built with Base UI (React Aria), offering the same features with a different component foundation.Installation
Features
- Base UI Primitives: Built on @base-ui/react
- Same API: Identical component API to fumadocs-ui
- Headless Architecture: More flexible for advanced customization
- Accessibility: Built on React Aria for robust a11y
When to Use
Use
@fumadocs/base-ui if you:- Prefer React Aria’s architecture
- Need more control over component internals
- Are already using Base UI in your project
fumadocs-ui is recommended for most use cases.Quick Start
1. Install Dependencies
2. Setup Root Provider
app/layout.tsx
3. Create a Documentation Layout
app/docs/layout.tsx
4. Create a Documentation Page
app/docs/[...slug]/page.tsx
Core Concepts
Component Architecture
Fumadocs UI follows a modular architecture:- Layouts: Full-page layouts with navigation, sidebar, and content areas
- Page Components: Structured page layouts with TOC, breadcrumbs, and footer
- UI Components: Reusable components for MDX content (cards, callouts, tabs, etc.)
- Primitives: Low-level UI components (buttons, accordions, dialogs)
Styling System
All components use Tailwind CSS with a custom design token system:- CSS variables for theming (
--color-fd-*) - Responsive utilities for all breakpoints
- Dark mode support via
next-themes - Custom animations and transitions
Accessibility
Every component is built with accessibility in mind:- Semantic HTML elements
- ARIA attributes and roles
- Keyboard navigation support
- Screen reader compatibility
- Focus management