# Tabs

> Put alternatives side by side, such as per-platform setup or per-language examples, and let readers pick the one they need.

Tabs show one of several versions of the same content. Readers click a tab to switch, and the rest stay out of the way.

<Tabs>
  <Tab title="macOS">
    Install with Homebrew:

    ```bash
    brew install acme
    ```
  </Tab>
  <Tab title="Linux">
    Install with your distribution's package manager:

    ```bash
    sudo apt install acme
    ```
  </Tab>
  <Tab title="Windows">
    Install with winget:

    ```powershell
    winget install acme
    ```
  </Tab>
</Tabs>

````mdx
<Tabs>
  <Tab title="macOS">
    Install with Homebrew:

    ```bash
    brew install acme
    ```
  </Tab>
  <Tab title="Linux">
    Install with your distribution's package manager:

    ```bash
    sudo apt install acme
    ```
  </Tab>
  <Tab title="Windows">
    Install with winget:

    ```powershell
    winget install acme
    ```
  </Tab>
</Tabs>
````

## How it works

Wrap one `<Tab>` per option in a `<Tabs>` block. Each tab's `title` becomes its label. The first tab is open when the page loads.

A tab can hold anything a page can: paragraphs, lists, code blocks, callouts, even other components.

<Tabs>
  <Tab title="REST">
    Send requests to `https://api.acme.com/v1`.

    <Callout type="tip">
      Every endpoint accepts and returns JSON.
    </Callout>
  </Tab>
  <Tab title="GraphQL">
    Send queries to `https://api.acme.com/graphql`.
  </Tab>
</Tabs>

```mdx
<Tabs>
  <Tab title="REST">
    Send requests to `https://api.acme.com/v1`.

    <Callout type="tip">
      Every endpoint accepts and returns JSON.
    </Callout>
  </Tab>
  <Tab title="GraphQL">
    Send queries to `https://api.acme.com/graphql`.
  </Tab>
</Tabs>
```

Each set of tabs on a page switches on its own. Picking a tab in one set doesn't change the others.

## Props

### Tabs

`<Tabs>` takes no props. Put `<Tab>` blocks inside it.

### Tab

| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `title` | string | `Tab 1`, `Tab 2`, … | The tab's label. Without one, the tab is numbered by position. |

## Tabs or a code group

If every tab holds only a code block, use a [code group](https://docs.typemark.dev/components/code-blocks#code-groups) instead. It puts the tabs in the code block's header bar and adds one copy button for whichever tab is showing.

## In the visual editor

Type `/` and pick **Tabs** to insert a block with two tabs. Click a tab to edit its content. Use **+** to add a tab, and the buttons next to the tabs to rename the active tab, move it left or right, or remove it. You can also double-click a tab to rename it or drag it to reorder.

<Callout type="tip">
  Keep tab labels short and parallel, like `macOS`, `Linux`, `Windows`. Readers scan them before they read anything else.
</Callout>
