RootProvider
Theme, search and framework providers for the root layout.
Installation
Usage
Wrap your app in RootProvider in the root layout, and add suppressHydrationWarning to <html> for next-themes:
It provides:
- next-themes, with a D hotkey to switch between light and dark mode
- search, with the default search dialog opened by ⌘ K or Ctrl K
- shadcn/ui's
TooltipProvider, which the sidebar uses - Base UI's
DirectionProvider - Fumadocs Core's Next.js adapter, for links, images and routing
Props
| Prop | Type | Description |
|---|---|---|
theme | ThemeProviderProps & { enabled?, hotKey? } | Options for next-themes. enabled: false removes it; hotKey changes or (false) disables the D hotkey. |
search | { enabled?, SearchDialog?, options?, links?, hotKey? } | Search options. SearchDialog replaces the default dialog, and options passes props to it (e.g. { api: "/api/search" }). |
dir | "ltr" | "rtl" | Text direction for Base UI components. Defaults to "ltr". |
components | { Link?, Image? } | Replace the Next.js Link and Image used by docscn components. |
useTheme is re-exported from @/components/docs/provider/base.