Tab
The <Tabs> component organizes content into separate tabs that users can switch between. Each tab can contain different types of content like examples, code snippets, or documentation sections.
Usage
First tab
Second tab
Third tab
☝️ Welcome to the content that you can only see inside the first tab.
Variants
Language synchronization
Tabs with the same language automatically synchronize across your documentation site. When a user selects a language, all tabs with that language switch to match. Language preferences persist across browser sessions.
TypeScript
Python
Java
TypeScript
Python
Java
Language-enabled tabs automatically synchronize with code blocks in that same language.
Tabs without the language property
Tabs without the language property don’t synchronize with other tabs on your site.
TypeScript
Python
Java
TypeScript
Python
Java
Linking to language-specific content
You can link directly to content in a specific language by adding ?language=<some-language> to the end of a URL. This sets which language tab wil be displayed by default when users visit the page.
For example, the following link opens with Java tabs displayed: https://buildwithfern.com/learn/docs/writing-content/components/tabs?language=java
This works with both CodeBlocks and Tab components that have a language property.
Properties
The title displayed in the tab header
The language associated with the code block. Any arbitrary string may be used.
When specified, enables global language synchronization across all tabs and code blocks with the same language value.
The content to be displayed when the tab is selected. Can include text, markdown, and components.
The unique ID for the tab. Used for linking and navigation. If not specified, an ID will be generated automatically.
Additional CSS classes to apply to the tab
<TabGroup> properties
Additional CSS classes to apply to the tab group