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
Partial<SidebarOptions>
-
containerProps
HTMLAttributes<HTMLDivElement>
-
links
LinkItem[]
-
nav
Partial<NavOptions>
-
children
ReactNode
-

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
enabled
boolean
-
component
ReactNode
-
githubUrl
string
-
title
ReactNode
-
children
ReactNode
-
url
string
'/'
links
NavLinkProps[]
-
transparentMode
"always" | "top" | "none"
none
PropTypeDefault
enabled
boolean
-
component
ReactNode
-
collapsible
boolean
-
footer
ReactNode
-
defaultOpenLevel
number
1
banner
ReactNode
-

Last updated on