Layout

The layout of documentation

The layout of documentation pages, it must be nested under the Root Provider.

It is a server component, you should not reference it in a client component.

Usage

Wrap the children and pass your page tree to the component.

import { DocsLayout } from 'fumadocs-ui/layout';

export default function Layout({ children }) {
  return <DocsLayout tree={tree}>{children}</DocsLayout>;
}
PropTypeDefault
tree
Root
-
sidebar
any
-
containerProps
HTMLAttributes<HTMLDivElement>
-
links
LinkItem[]
-
nav
any
-
children
any
-

Non-docs Pages

If you want to share navbar and search dialog between other pages, you may use the Layout component for non-docs page.

It doesn't contain a sidebar, therefore, a page tree is not required.

import { Layout } from 'fumadocs-ui/layout';

export default function HomeLayout({ children }) {
  return <Layout>{children}</Layout>;
}

You can create a Route Group to share the same layout across multiple pages.

PropTypeDefault
PropTypeDefault

Last updated on