Logo

Getting Started

IntroductionInstallationQuick Start
Logo
DocumentationAPI ReferenceChangelog

Components

Tabs

Organize content into interactive tabbed sections

Overview

The <Tabs> component organizes content into switchable sections. Perfect for showing platform-specific instructions, code examples in different languages, or alternative approaches.

Basic Usage

JavaScript is a versatile programming language.

Package Manager Examples

Common use case for installation instructions:

npm install @acme/sdk

Platform-Specific Instructions

Show different instructions based on operating system:

Install using Homebrew:

brew install acme-cli

Or download the .dmg installer from our website.

Language-Specific Code Examples

Perfect for showing the same functionality in different languages:

curl -X POST https://api.example.com/users \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name":"John Doe","email":"john@example.com"}'

Rich Content

Tabs support complex content including multiple components:

Quick Start

Get up and running in minutes:

1

Install

npm install @acme/sdk
2

Initialize

import { init } from '@acme/sdk';
init({ apiKey: 'YOUR_KEY' });

Default Tab

Control which tab is active by default:

TypeScript will be shown first (default).

The defaultValue must match a tab's title exactly (case-sensitive).

Props

Tabs Props

children
ReactNoderequired

The <Tab> components to render. Only direct <Tab> children are processed.

<Tabs>
  <Tab title="First">...</Tab>
  <Tab title="Second">...</Tab>
</Tabs>
defaultValue
string

The title of the tab to show by default. If not specified, the first tab is active.

<Tabs defaultValue="TypeScript">
  <Tab title="JavaScript">...</Tab>
  <Tab title="TypeScript">...</Tab>
</Tabs>
colorPalette
string

Color palette for active tab indicators. Defaults to site's colorPalette.

<Tabs colorPalette="purple">...</Tabs>

Tab Props

title
stringrequired

The label displayed in the tab selector.

<Tab title="JavaScript">JavaScript content here</Tab>
children
ReactNoderequired

The content shown when this tab is active. Supports full Markdown.

<Tab title="Example">You can use **bold**, *italic*, and [links](/docs).</Tab>

Next, learn about the ParamField Component for documenting parameters.

Built with Chakra UI

On this page
OverviewBasic UsagePackage Manager ExamplesPlatform-Specific InstructionsLanguage-Specific Code ExamplesRich ContentDefault TabPropsTabs PropsTab Props