Skip to navigation

Tabs

Group content into switchable tabs with optional variants and menus
View as Markdown

Tabs split a product or version into parallel bodies of content, each with its own sidebar. Tab variants give a single tab more than one version of its content, such as REST versus GraphQL or beginner versus advanced.

Two tabs make sense when the content is unrelated, like guides and an API Reference. Variants of one tab make sense when it covers the same ground for a different reader. A tab menu collects several tabs under one header tab, such as a Products tab with one tab per product.

Tabs

To configure tabs:

  • Declare each tab under the top-level tabs key with a display-name and an icon.
  • Reference the tab in navigation with tab:. Each tab requires either a layout for its content, variants for tab variants, or an href pointing at an external URL.
docs.yml
tabs: # Declare each tab
api:
display-name: API Reference
icon: puzzle # Font Awesome icon
help:
display-name: Help center
icon: ./assets/icons/help-icon.svg # Custom image file
github:
display-name: GitHub
icon: brands github # Font Awesome icon
href: https://github.com/fern-api/fern
target: _blank # Link opens in a new tab
navigation: # Reference each tab by its key
- tab: api
layout:
- section: Introduction
contents:
- page: My page
path: my-page.mdx
- api: API Reference
- tab: help
layout:
- section: Help center
contents:
- page: Contact us
path: contact-us.mdx
- tab: github # External link, so no layout
Tabs displayed in the sidebar (default)
Tab icons

Icons can be in three formats:

  • Font Awesome icons: Use icon names like fa-solid fa-rocket. Pro and Brand Icons from Font Awesome are supported.
  • Custom image files: Use relative paths to image files (e.g., ./assets/icons/my-icon.svg or ../assets/icons/my-icon.png). Paths are relative to the YAML file where the icon is referenced (e.g., docs.yml). For example, if you set an icon in fern/products/my-product.yml, the path ./assets/icon.svg resolves to fern/products/assets/icon.svg. If you set it in fern/docs.yml, the same path resolves to fern/assets/icon.svg.
  • Inline SVG: Provide an SVG string wrapped in quotes (e.g., "<svg>...</svg>").

Tabs placement and styling

Tabs display in the left sidebar by default. Use theme.tabs to control placement, style, and alignment.

docs.yml
theme:
tabs:
style: bubble # "default" (underline) or "bubble" (pill-shaped)
alignment: center # "left" or "center" (center only applies to header tabs)
placement: header # "header" or "sidebar"

When header tabs don’t fit in the header, the tab row scrolls horizontally. A scrollable edge fades out and shows a chevron button that scrolls the row by one tab, and the active tab scrolls into view when the page loads. The chevrons are hidden when the row can’t scroll further in that direction. Style the row with the .fern-header-tabs-* selectors.

Tab properties

display-name
stringRequired

The name shown in the tab header

icon
string

Icons can be in three formats:

  • Font Awesome icons: Use icon names like fa-solid fa-rocket. Pro and Brand Icons from Font Awesome are supported.
  • Custom image files: Use relative paths to image files (e.g., ./assets/icons/my-icon.svg or ../assets/icons/my-icon.png). Paths are relative to the YAML file where the icon is referenced (e.g., docs.yml). For example, if you set an icon in fern/products/my-product.yml, the path ./assets/icon.svg resolves to fern/products/assets/icon.svg. If you set it in fern/docs.yml, the same path resolves to fern/assets/icon.svg.
  • Inline SVG: Provide an SVG string wrapped in quotes (e.g., "<svg>...</svg>").
slug
string

Custom URL slug for the tab

skip-slug
boolean

Exclude the tab slug from URLs

hidden
boolean

Hide the tab from navigation. See Hiding content for details.

layout
list

Navigation structure for the tab’s content. Required unless the tab uses variants or href.

variants
list

List of tab variants. Use instead of layout.

tab-menu
list

Turns the tab into a tab menu of other tabs that opens from the header. Set on the tab’s entry under tabs, not in navigation. Each tab in the menu still needs its own - tab: entry in navigation.

tab-menu-column-height
integer | "no-limit"

Maximum number of entries per column in the tab’s menu. no-limit keeps a single column. Overrides layout.tab-menu.default-column-height. Only applies when the tab has a tab-menu.

href
string

External URL. When set, clicking the tab redirects to this URL. Tabs with href must not include layout or variants.

target
string

Where the link opens. One of _blank, _self, _parent, or _top.

changelog
string

Path to a changelog folder, relative to the YAML file where it is set (e.g., docs.yml)

viewers
string | list

Role-based access control for the tab

orphaned
boolean

When true, roles don’t inherit from parent elements

feature-flag
string | object

Conditional display configuration

Tab variants

To add variants to a tab:

  • Replace the tab’s layout with a variants list. The declaration under tabs: doesn’t change.
  • Give each variant a title and its own layout.

Variants support RBAC, so a variant can be limited to readers holding a given role.

docs.yml
tabs:
api:
display-name: API Reference
icon: puzzle
help:
display-name: Help center
icon: home
github:
display-name: GitHub
icon: brands github
href: https://github.com/fern-api/fern
navigation:
- tab: api
layout:
- section: Introduction
contents:
- page: My page
path: my-page.mdx
- api: API Reference
- tab: help
variants: # Replaces this tab's layout
- title: For developers # Each variant has its own title and layout
layout:
- section: Getting started
contents:
- page: Quick start
path: ./pages/dev-quickstart.mdx
- title: For product managers
layout:
- section: Getting started
contents:
- page: Overview
path: ./pages/pm-overview.mdx
- tab: github

A variants list also accepts group entries and links. A group adds a header above its items in the variant selector, and a link (link and href) points at an external URL. Groups hold variants and links, not other groups.

docs.yml
navigation:
- tab: sdks
variants:
- group: Server SDKs
items:
- title: Python
layout:
- page: Quickstart
path: ./pages/python-quickstart.mdx
- title: TypeScript
layout:
- page: Quickstart
path: ./pages/typescript-quickstart.mdx
- link: SDK status
href: https://status.example.com

Variant properties

title
stringRequired

Display name for the variant

layout
listRequired

Navigation structure using the same format as regular tab layouts

subtitle
string

Text displayed below the variant title

icon
string

Icons can be in three formats:

  • Font Awesome icons: Use icon names like fa-solid fa-rocket. Pro and Brand Icons from Font Awesome are supported.
  • Custom image files: Use relative paths to image files (e.g., ./assets/icons/my-icon.svg or ../assets/icons/my-icon.png). Paths are relative to the YAML file where the icon is referenced (e.g., docs.yml). For example, if you set an icon in fern/products/my-product.yml, the path ./assets/icon.svg resolves to fern/products/assets/icon.svg. If you set it in fern/docs.yml, the same path resolves to fern/assets/icon.svg.
  • Inline SVG: Provide an SVG string wrapped in quotes (e.g., "<svg>...</svg>").
slug
string

Custom URL slug for the variant

skip-slug
boolean

Exclude the variant slug from URLs

hidden
boolean

Hide the variant from navigation. See Hiding content for details.

default
boolean

When true, this variant displays by default. If not specified, the first variant in the list is used.

viewers
string | list

Role-based access control for the variant

orphaned
boolean

When true, roles don’t inherit from parent elements

feature-flag
string | object

Conditional display configuration

Tab menus

A tab menu turns a header tab into a menu of other tabs. The menu opens when a reader hovers over the tab, and each entry opens a tab with its own sidebar. Use a tab menu when a site has more top-level areas than fit in the header, such as one tab per product.

To configure a tab menu:

  • Add a tab-menu to the menu tab’s entry under tabs. Each entry declares a menu tab with a tab ID and a display-name. Menu tabs aren’t also declared under tabs.
  • In navigation, add a - tab: entry for the menu tab with no layout or variants. Its position sets where the menu sits in the header.
  • Menu tabs still need to be defined in navigation. Add a - tab: entry for each one with a layout, or with variants that show in a selector at the top of that tab’s sidebar.

Tab menus require header tabs (layout.tabs-placement: header or theme.tabs.placement: header). Without header tabs, the menu’s tabs show in a selector at the top of the sidebar instead, and fern check warns.

Products tab menu open in the header, with Platform and Data groups, a Status link, and a Legacy tab
docs.yml
layout:
tabs-placement: header
tabs:
guides:
display-name: Guides
products:
display-name: Products
tab-menu:
- group: Platform # Header above a group of tabs
tabs:
- tab: agents
display-name: Agents
subtitle: Build AI agents
- tab: studio
display-name: Studio
- link: Status # External link
href: https://status.example.com
- tab: legacy
display-name: Legacy
navigation:
- tab: guides
layout:
- page: Overview
path: ./pages/overview.mdx
- tab: products # Places the menu in the header, so no layout
- tab: agents
layout:
- page: Overview
path: ./pages/agents.mdx
- tab: studio
layout:
- page: Overview
path: ./pages/studio.mdx
- tab: legacy
layout:
- page: Overview
path: ./pages/legacy.mdx

Menu tab URLs nest under the menu tab, so the Agents overview is served at /products/agents/overview. Two menu tabs in one menu can’t share a slug; set slug on one of them when their display names match.

Agents menu tab selected, with the Products header tab highlighted and the Agents sidebar shown

A tab-menu entry is a menu tab, a group, or a link. A group has a header and a tabs list of menu tabs and links. A link has link and href, plus an optional icon and target. Groups can’t contain other groups. Menu tabs inside a group still need their own - tab: entry in navigation.

Columns and behavior

Long menus split into columns. Set the maximum number of entries per column with tab-menu-column-height on the tab, or for every menu with layout.tab-menu.default-column-height. Use no-limit for a single column.

Menus open on hover and close when the pointer leaves the tab and menu.

docs.yml
layout:
tabs-placement: header
tab-menu:
default-column-height: 6
tabs:
products:
display-name: Products
tab-menu-column-height: no-limit # Overrides the default for this menu
tab-menu:
- tab: agents
display-name: Agents
tab-menu[].tab
stringRequired

ID of the menu tab. Each menu tab needs a matching - tab: entry in navigation that holds its pages.

tab-menu[].display-name
stringRequired

Name shown in the menu

tab-menu[].subtitle
string

Text displayed below the name in the menu

tab-menu[].icon
string

Icons can be in three formats:

  • Font Awesome icons: Use icon names like fa-solid fa-rocket. Pro and Brand Icons from Font Awesome are supported.
  • Custom image files: Use relative paths to image files (e.g., ./assets/icons/my-icon.svg or ../assets/icons/my-icon.png). Paths are relative to the YAML file where the icon is referenced (e.g., docs.yml). For example, if you set an icon in fern/products/my-product.yml, the path ./assets/icon.svg resolves to fern/products/assets/icon.svg. If you set it in fern/docs.yml, the same path resolves to fern/assets/icon.svg.
  • Inline SVG: Provide an SVG string wrapped in quotes (e.g., "<svg>...</svg>").
tab-menu[].slug
string

Custom URL slug for the menu tab

tab-menu[].skip-slug
boolean

Exclude the menu tab slug from URLs

tab-menu[].hidden
boolean

Hide the menu tab from the menu. See Hiding content for details.

tab-menu[].default
boolean

When true, this menu tab displays by default. If not specified, the first tab in the menu is used.

tab-menu[].viewers
string | list

Role-based access control for the menu tab

tab-menu[].orphaned
boolean

When true, roles don’t inherit from parent elements

tab-menu[].feature-flag
string | object

Conditional display configuration