Skip to content

Commit

Permalink
Docs: add guide for replacing navbar
Browse files Browse the repository at this point in the history
  • Loading branch information
fuma-nama committed Dec 15, 2024
1 parent 3933ccf commit 1eec049
Showing 1 changed file with 35 additions and 1 deletion.
36 changes: 35 additions & 1 deletion apps/docs/content/docs/ui/blocks/layout.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ You can consider:

## Notebook

Enable the notebook layout with `fumadocs-ui/layouts/notebook`.
Enable the notebook layout with `fumadocs-ui/layouts/notebook`, it's a more compact layout than the default one.

![Notebook](/docs/notebook.png)

Expand All @@ -138,6 +138,40 @@ export default function Layout({ children }: { children: ReactNode }) {
}
```

### Replacing Navbar

Fumadocs uses CSS Variables to share the size of layout components, and fit each layout component into appropriate position.

To replace the navbar in Docs Layout, set `nav.component` to your own component.

```tsx title="layout.tsx"
import { DocsLayout } from 'fumadocs-ui/layouts/notebook';
import type { ReactNode } from 'react';

export default function Layout({ children }: { children: ReactNode }) {
return (
<DocsLayout
// other options
nav={{
component: <CustomNavbar />,
}}
>
{children}
</DocsLayout>
);
}
```

You need to override `--fd-nav-height` to the exact height of your custom navbar, this can be done with a CSS stylesheet (e.g. in `global.css`):

```css
:root {
--fd-nav-height: 80px !important;
}
```

Note that `!important` is required to override CSS variables.

## References

### Sidebar
Expand Down

0 comments on commit 1eec049

Please sign in to comment.