Tabs
Switchable panels for mutually exclusive content like package managers or languages. Matching tab titles sync across the entire page.
Use Tabs for parallel alternatives: package managers, programming languages, or OS-specific instructions. Readers pick once and stay in context. Matching tab titles sync across the page. Select "yarn" in one group and every other npm/yarn/pnpm group switches to match.
Use Tabs when:
- Multiple implementations of the same concept exist (npm/yarn/pnpm, JavaScript/Python)
- Parallel options are mutually exclusive (the reader picks one)
- Consistency matters: the reader's choice should persist throughout the page
Usage
<Tabs>
<Tab title="npm">npm install jamdesk</Tab>
<Tab title="pnpm">pnpm add jamdesk</Tab>
</Tabs>
Basic Tabs
Content for the first tab.
<Tabs>
<Tab title="First Tab">
Content for the first tab.
</Tab>
<Tab title="Second Tab">
Content for the second tab.
</Tab>
<Tab title="Third Tab">
Content for the third tab.
</Tab>
</Tabs>
Tabs vs CodeGroup vs Accordion
| Component | Best For | Synchronizes |
|---|---|---|
| Tabs | Mutually exclusive content choices | Yes (across page) |
| CodeGroup | Code blocks in multiple languages | No |
| Accordion | Collapsible sections, FAQs | No |
Rule of thumb: Use Tabs when the reader's choice (like preferred package manager) should persist throughout the page. Use CodeGroup for code-only comparisons. Use Accordion for content that can all be relevant.
Tabs with Icons
Add Font Awesome icons to tab titles:
function App() {
return <h1>Hello React</h1>;
}<Tabs>
<Tab title="React" icon="react" iconType="brands">
```jsx
function App() {
return <h1>Hello React</h1>;
}
```
</Tab>
<Tab title="Vue" icon="vuejs" iconType="brands">
```vue
<template>
<h1>Hello Vue</h1>
</template>
```
</Tab>
</Tabs>
Border Bottom
Use the borderBottom prop to add a visual separator below the tab content:
This tab group has a bottom border for visual separation.
<Tabs borderBottom>
<Tab title="Overview">
This tab group has a bottom border for visual separation.
</Tab>
<Tab title="Details">
Useful when tabs contain varying content lengths.
</Tab>
</Tabs>
Synchronized Tabs
Tabs with matching titles sync across the page. Click "yarn" in one group and every npm/yarn/pnpm group on the page switches with it:
Install:
npm install my-packageRun:
npm run devSynchronization happens when tab titles match (case-insensitive).
Props
Tabs
booleandefault: falseAdds a bottom border and padding to the tab content container. Use it to separate tabbed content from the rest of the page.
Tab
stringrequiredThe label displayed in the tab bar. Tabs with matching titles sync their selection across the page.
stringFont Awesome icon name to display before the title (e.g., "react", "code", "terminal").
stringdefault: solidFont Awesome icon style. Options: regular, solid, light, thin, sharp-solid, duotone, brands.
