Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions fern/products/docs/pages/customization/custom-header-footer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,43 @@ Replace Fern's default header or footer with your own React components. Componen
```
</Steps>

## Advanced configuration
## Built-in Fern components

<AccordionGroup>
<Accordion title="Header with dropdown menu">
<Note title="Beta">
Built-in Fern components are in beta and subject to change.
</Note>

Custom header and footer components receive a `Fern` prop containing built-in UI components. This lets you compose custom layouts while reusing Fern's built-in primitives like search, navigation, and theme switching.

```tsx components/CustomHeader.tsx
export default function CustomHeader({ Fern }) {
return (
<header className="w-full py-4 px-6 flex items-center justify-between">
<Fern.Logo />
<Fern.Search />
<nav className="flex items-center gap-4">
<Fern.NavbarLinks />
<Fern.ThemeSwitch />
</nav>
</header>
);
}
```

The following components are available on the `Fern` prop:

| Component | Description |
| --- | --- |
| `<Fern.Logo />` | Your site logo as configured in `docs.yml`. Links to the homepage. |
| `<Fern.Search />` | The search bar, including the AI search trigger if enabled. |
| `<Fern.ProductSwitcher />` | Drop-down to switch between products (only renders if you have multiple products configured). |
| `<Fern.VersionSwitcher />` | Drop-down to switch between API versions (only renders if you have versions configured). |
| `<Fern.LanguageSwitcher />` | Drop-down to switch the active language. |
| `<Fern.NavbarLinks />` | The navigation links configured under `navbar-links` in `docs.yml`. |
| `<Fern.LoginButton />` | The login/signup button for authenticated docs. |
| `<Fern.ThemeSwitch />` | Toggle between light and dark mode. |

## Using React Hooks
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📝 [vale] reported by reviewdog 🐶
[FernStyles.Headings] 'Using React Hooks' should use sentence-style capitalization.


You can use React `useState` to build interactive headers with drop-down menus. Below is an example that renders a navigation bar with a "Products" drop-down that opens on click:

Expand Down Expand Up @@ -116,6 +149,3 @@ export default function CustomHeader() {
);
}
```

</Accordion>
</AccordionGroup>