*** title: Tab description: >- The Tabs component allows you to display related content in a tabbed view with support for language synchronization. ------------------------------------- For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see [https://buildwithfern.com/learn/llms.txt](https://buildwithfern.com/learn/llms.txt). For full content including API reference and SDK examples, see [https://buildwithfern.com/learn/llms-full.txt](https://buildwithfern.com/learn/llms-full.txt). The `` 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
☝️ Welcome to the content that you can only see inside the first tab. ✌️ Here's content that's only inside the second tab. 💪 Here's content that's only inside the third tab.
```jsx Markdown ☝️ Welcome to the content that you can only see inside the first tab. ✌️ Here's content that's only inside the second tab. 💪 Here's content that's only inside the third tab. ``` ## Variants ### Language synchronization Tabs with the [same language](/learn/docs/writing-content/components/code-blocks#supported-languages) 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 console.log("First code block!"); ``` ```python print("First code block!") ``` ```java System.out.println("First code block!"); ``` ```typescript console.log("Second code block – language syncs with the one above!"); ``` ```python print("Second code block – language syncs with the one above!") ``` ```java System.out.println("Second code block – language syncs with the one above!"); ```
````jsx ```typescript console.log("Content inside the TypeScript tab"); ``` ```python print("Content inside the Python tab") ``` ```java System.out.println("Content inside the Java tab"); ``` ```` Language-enabled tabs automatically synchronize with [code blocks in that same language](/docs/writing-content/components/code-blocks#language-synchronization). Tabs without the `language` property don't synchronize with other tabs on your site.
```typescript console.log("First code block!"); ``` ```python print("First code block!") ``` ```java System.out.println("First code block!"); ``` ```typescript console.log("Second code block – this won't sync with the one above!"); ``` ```python print("Second code block – this won't sync with the one above!") ``` ```java System.out.println("Second code block – this won't sync with the one above!"); ```
````jsx ```typescript console.log("Content inside the TypeScript tab, with no language property"); ``` ```python print("Content inside the Python tab, with no language property") ``` ```java System.out.println("Content inside the Java tab, with no language property"); ``` ````
For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see [https://buildwithfern.com/learn/llms.txt](https://buildwithfern.com/learn/llms.txt). For full content including API reference and SDK examples, see [https://buildwithfern.com/learn/llms-full.txt](https://buildwithfern.com/learn/llms-full.txt). You can link directly to content in a specific language by adding `?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](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 ### `` properties Additional CSS classes to apply to the tab group