---
title: "RootProvider"
description: "Theme, search, translation and framework providers for the root layout."
url: https://docscn.dev/docs/components/root-provider
lastModified: 2026-10-08T17:19:39.000Z
---

# RootProvider (/docs/components/root-provider)

> Theme, search, translation and framework providers for the root layout.

## Installation [#installation]

```npm
npx shadcn@latest add @docscn/root-provider
```

## Usage [#usage]

Wrap your app in `RootProvider` in the root layout, and add `suppressHydrationWarning` to `<html>` for next-themes:

```tsx title="app/layout.tsx"
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](https://github.com/pacocoursey/next-themes), with a <kbd>D</kbd> hotkey to switch between light and dark mode
- search, with the [default search dialog](/docs/components/search-dialog) opened by <kbd>⌘</kbd> <kbd>K</kbd> or <kbd>Ctrl</kbd> <kbd>K</kbd>
- shadcn/ui's `TooltipProvider`, which the sidebar uses
- Base UI's `DirectionProvider`
- translations of the UI strings, with the `i18n` prop
- Fumadocs Core's Next.js adapter, for links, images and routing

## Props [#props]

<TypeTable
  type={{
    theme: {
      description: (
        <>
          Options for next-themes. <code>{"enabled: false"}</code> removes it;{" "}
          <code>{"hotKey"}</code> changes or (<code>{"false"}</code>) disables
          the <kbd>D</kbd> hotkey.
        </>
      ),
      type: "ThemeProviderProps & { enabled?, hotKey? }",
    },
    search: {
      description: (
        <>
          Search options. <code>{"SearchDialog"}</code> replaces the default
          dialog, and <code>{"options"}</code> passes props to it (e.g.{" "}
          <code>{'{ api: "/api/search" }'}</code>).
        </>
      ),
      type: "{ enabled?, SearchDialog?, options?, links?, hotKey? }",
    },
    i18n: {
      description: (
        <>
          The UI strings' translations and the available languages. Build it
          with <code>{"i18nProvider()"}</code>; see{" "}
          <a href="/docs/internationalization">Internationalization</a>.
        </>
      ),
      type: "{ locale?, locales?, translations?, defaultLanguage?, hideLocale?, onLocaleChange? }",
    },
    dir: {
      description: <>Text direction for Base UI components.</>,
      type: '"ltr" | "rtl"',
      default: '"ltr"',
    },
    components: {
      description: (
        <>
          Replace the Next.js <code>{"Link"}</code> and <code>{"Image"}</code>{" "}
          used by docscn components.
        </>
      ),
      type: "{ Link?, Image? }",
    },
  }}
/>

`useTheme` is re-exported from `@/components/docs/provider/base`.