Tabs

Group content into switchable tabs with optional variants

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.

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
1tabs: # Declare each tab
2 api:
3 display-name: API Reference
4 icon: puzzle # Font Awesome icon
5 help:
6 display-name: Help center
7 icon: ./assets/icons/help-icon.svg # Custom image file
8 github:
9 display-name: GitHub
10 icon: brands github # Font Awesome icon
11 href: https://github.com/fern-api/fern
12 target: _blank # Link opens in a new tab
13
14navigation: # Reference each tab by its key
15 - tab: api
16 layout:
17 - section: Introduction
18 contents:
19 - page: My page
20 path: my-page.mdx
21 - api: API Reference
22 - tab: help
23 layout:
24 - section: Help center
25 contents:
26 - page: Contact us
27 path: contact-us.mdx
28 - 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
1theme:
2 tabs:
3 style: bubble # "default" (underline) or "bubble" (pill-shaped)
4 alignment: center # "left" or "center" (center only applies to header tabs)
5 placement: header # "header" or "sidebar"

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.

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
1tabs:
2 api:
3 display-name: API Reference
4 icon: puzzle
5 help:
6 display-name: Help center
7 icon: home
8 github:
9 display-name: GitHub
10 icon: brands github
11 href: https://github.com/fern-api/fern
12
13navigation:
14 - tab: api
15 layout:
16 - section: Introduction
17 contents:
18 - page: My page
19 path: my-page.mdx
20 - api: API Reference
21 - tab: help
22 variants: # Replaces this tab's layout
23 - title: For developers # Each variant has its own title and layout
24 layout:
25 - section: Getting started
26 contents:
27 - page: Quick start
28 path: ./pages/dev-quickstart.mdx
29 - title: For product managers
30 layout:
31 - section: Getting started
32 contents:
33 - page: Overview
34 path: ./pages/pm-overview.mdx
35 - tab: github

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