Global Options
All commands support the following global option:--config
Specify a custom path to the CLI configuration file.
./cli.json
fumadocs
Initialize a new CLI configuration file in your project.
Behavior
- Creates a
cli.jsonfile in the current directory - Automatically detects if your project uses a
srcdirectory - Skips creation if a configuration file already exists
- Provides sensible defaults based on project structure
Example Output
Success:Generated Configuration
Without src directory
Without src directory
cli.json
With src directory
With src directory
cli.json
fumadocs add
Install components from the Fumadocs registry.
Arguments
[components...]
One or more component names to install. If omitted, launches an interactive component picker.
Options
--dir <string>
Specify the registry URL or local directory to resolve components from.
https://fumadocs.dev/registry
Supported shortcuts:
:preview→https://preview.fumadocs.dev/registry:dev→http://localhost:3000/registry
Interactive Mode
When no components are specified, the CLI launches an interactive picker:- Browse all available components from your configured registry
- View component descriptions and titles
- Multi-select components to install
- Autocomplete search functionality
- Shows components from both main and UI-specific registries
Installation Flow
Component Selection
The CLI fetches the registry and displays available components with descriptions.
File Installation
Downloads component files to configured directories:
- UI components →
componentsDir/ui - Regular components →
componentsDir - Library utilities →
libDir - Styles →
cssDir - Routes → project root
Example Output
Component Namespaces
Components can be prefixed with a namespace to access UI-specific variants:uiLibrary configuration.
fumadocs customise
Interactively customize Fumadocs UI layouts.
Also available as
fumadocs customize (American spelling).Options
--dir <string>
Specify the registry directory or URL.
https://fumadocs.dev/registry
Interactive Workflow
The command guides you through a two-step process:Choose Layout Type
Select which layout to customize:
- Docs Layout: Main UI for documentation pages
- Home Layout: Navbar for landing and other pages
Example Session
Layout Variants
Docs Layout - Minimal
Docs Layout - Minimal
Component:
fumadocs/ui/layouts/docs-minDescription: Bare-bones layout structure with minimal styling. Perfect for building custom layouts from the ground up.Import replacements:fumadocs-ui/layouts/docs→@/components/layout/docsfumadocs-ui/layouts/docs/page→@/components/layout/docs/page
Docs Layout - Default
Docs Layout - Default
Component:
fumadocs/radix-ui/layouts/docs or fumadocs/base-ui/layouts/docsDescription: Standard Fumadocs layout with sidebar, table of contents, and search.Import replacements:fumadocs-ui/layouts/docs→@/components/layout/docsfumadocs-ui/layouts/docs/page→@/components/layout/docs/page
Docs Layout - Notebook
Docs Layout - Notebook
Component:
fumadocs/radix-ui/layouts/notebook or fumadocs/base-ui/layouts/notebookDescription: Notebook-style layout with centered content and elegant spacing.Import replacements:fumadocs-ui/layouts/notebook→@/components/layout/notebookfumadocs-ui/layouts/notebook/page→@/components/layout/notebook/page
Docs Layout - Flux
Docs Layout - Flux
Component:
fumadocs/radix-ui/layouts/flux or fumadocs/base-ui/layouts/fluxDescription: Modern Flux layout with enhanced visual hierarchy.Import replacements:fumadocs-ui/layouts/flux→@/components/layout/fluxfumadocs-ui/layouts/flux/page→@/components/layout/flux/page
Home Layout
Home Layout
Component:
fumadocs/radix-ui/layouts/home or fumadocs/base-ui/layouts/homeDescription: Navigation bar for landing pages and non-documentation pages.Import replacements:fumadocs-ui/layouts/home→@/components/layout/home
Post-Installation Steps
After customizing a layout:- Open your root layout file (e.g.,
app/layout.tsxorapp/docs/layout.tsx) - Replace the Fumadocs UI imports with your local component paths
- Customize the components in the
components/layout/directory
app/docs/layout.tsx
app/docs/layout.tsx
fumadocs tree
Generate file tree components from directory structures.
Arguments
[json_or_args]
Either:
- JSON output from the
treecommand - Arguments to pass to the
treecommand (defaults to./)
[output]
Output file path. If omitted, prints to stdout.
Options
--js
Output as a JavaScript/TypeScript file instead of MDX.
--no-root
Remove the root directory node from the output.
--import-name <name>
Customize the import path for JavaScript output (only with --js).
fumadocs-ui/components/files
Prerequisites
Thetree command must be installed on your system:
Usage Examples
Output Formats
- MDX Output
- JavaScript Output
Generated MDX:Rendered in docs:
- Displays as an interactive file tree
- Folders are collapsible
- Uses Fumadocs UI styling
Advanced Examples
Generate from specific directory
Generate from specific directory
Collapse single-child directories
Collapse single-child directories
The CLI automatically collapses directories with only one child:
Exclude node_modules and git files
Exclude node_modules and git files
The
tree command automatically runs with --gitignore and --prune flags to exclude:- Files in
.gitignore - Empty directories
- Git metadata
Command Aliases
| Command | Alias |
|---|---|
fumadocs customise | fumadocs customize |
Exit Codes
| Code | Description |
|---|---|
0 | Success |
-1 | Installation error or component not found |
0 (after cancel) | User cancelled operation |
Tips and Best Practices
Use interactive mode for discovery
Use interactive mode for discovery
When you’re not sure which components are available, use interactive mode:This shows all available components with descriptions.
Test with preview registry
Test with preview registry
Before using new components in production, test them from the preview registry:
Customize before customizing
Customize before customizing
Use
fumadocs customise instead of manually copying files to ensure you get all dependencies and proper import paths.Version control your cli.json
Version control your cli.json
Commit your
cli.json to version control so team members have consistent component installation paths.