Tabs

Tabs let you organize related content into switchable panels, perfect for showing alternatives like different programming languages or platforms.

Basic Tabs

javascript
console.log('Hello, world!');
markdown
<Tabs>
  <Tab name="JavaScript">
    ```javascript
    console.log('Hello, world!');
    ```
  </Tab>
  <Tab name="Python">
    ```python
    print('Hello, world!')
    ```
  </Tab>
  <Tab name="Dart">
    ```dart
    print('Hello, world!');
    ```
  </Tab>
</Tabs>

Tabs with Rich Content

Tabs can contain any Markdown content, not just code:

Installing on macOS

Use Homebrew for the easiest installation:

bash
brew install stardust

Or download the binary directly from the releases page.

Package Manager Examples

A common use case — showing installation commands for different package managers:

bash
npm install my-package
markdown
<Tabs>
  <Tab name="npm">
    ```bash
    npm install my-package
    ```
  </Tab>
  <Tab name="yarn">
    ```bash
    yarn add my-package
    ```
  </Tab>
  <Tab name="pnpm">
    ```bash
    pnpm add my-package
    ```
  </Tab>
  <Tab name="bun">
    ```bash
    bun add my-package
    ```
  </Tab>
</Tabs>

Framework Comparison

jsx
function App() {
  return <h1>Hello, React!</h1>;
}

Best Practices

Info

  • Use tabs when showing equivalent alternatives (languages, platforms, methods)
  • Keep tab names short and descriptive
  • Ensure each tab has similar content structure
  • Don't nest tabs inside tabs

Persistent Tab Selection

Tab selections are remembered within the page. When a user selects "Python" in one tab group, other tab groups with a "Python" option will also switch.

Variable declaration in Python:

python
name = "Stardust"

Function definition in Python:

python
def greet(name):
    return f"Hello, {name}!"

Select a language above and watch both tab groups sync!