RootProvider
Theme, search, translation and framework providers for the root layout.
Installation
npx shadcn@latest add @docscn/root-providerUsage
Wrap your app in RootProvider in the root layout, and add suppressHydrationWarning to <html> for next-themes:
import { RootProvider } from "@/components/docs/provider/next";
export default function RootLayout({
children,
}: {
children: React.ReactNode;
}) {
return (
<html lang="en" suppressHydrationWarning>
<body>
<RootProvider>{children}</RootProvider>
</body>
</html>
);
}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 - translations of the UI strings, with the
i18nprop - Fumadocs Core's Next.js adapter, for links, images and routing
Props
Prop
Type
useTheme is re-exported from @/components/docs/provider/base.