zudo-doc

Type to search...

to open search from anywhere

Tabs

CreatedMar 22, 2026Takeshi Takatsudo

Tabbed content panels for showing alternatives like package managers or platform-specific instructions.

Use <Tabs> and <TabItem> to create tabbed content panels. Both components are globally available — no imports needed.

Basic Usage

<Tabs>
  <TabItem label="npm" value="npm" default>
    ```bash
    npm install zudo-doc
    ```
  </TabItem>
  <TabItem label="pnpm" value="pnpm">
    ```bash
    pnpm add zudo-doc
    ```
  </TabItem>
  <TabItem label="yarn" value="yarn">
    ```bash
    yarn add zudo-doc
    ```
  </TabItem>
</Tabs>

The default prop on TabItem sets which tab is initially active. If omitted, the first tab is shown.

Synced Tabs

Use groupId to sync tab selection across multiple tab groups on the same page. The selected tab is persisted in localStorage, so it carries across page navigations.

<Tabs groupId="lang">
  <TabItem label="JavaScript" value="js" default>
    ```js
    console.log("Hello");
    ```
  </TabItem>
  <TabItem label="TypeScript" value="ts">
    ```ts
    console.log("Hello" as string);
    ```
  </TabItem>
</Tabs>

<!-- Selecting a tab in the group above syncs this group too -->
<Tabs groupId="lang">
  <TabItem label="JavaScript" value="js" default>
    ```js
    const sum = (a, b) => a + b;
    ```
  </TabItem>
  <TabItem label="TypeScript" value="ts">
    ```ts
    const sum = (a: number, b: number): number => a + b;
    ```
  </TabItem>
</Tabs>

Tabs Props

PropTypeDefaultDescription
groupIdstringSync tab selection across groups with the same groupId (persisted in localStorage)

TabItem Props

PropTypeDefaultDescription
labelstring(required)Tab button text
valuestringValue of labelUnique identifier for the tab
defaultbooleanfalseSet as the initially active tab

Revision History

AI Assistant

Ask a question about the documentation.