Tabs

Tabs organise content into named sections that the user can switch between without leaving the page.

Project summary, milestones and recent activity.
tsx
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

<Tabs defaultValue="overview">
  <Tabs.List>
    <Tabs.Item value="overview">
      <Tabs.Label>Overview</Tabs.Label>
    </Tabs.Item>
    <Tabs.Item value="members">
      <Tabs.Label>Members</Tabs.Label>
      <Tabs.Count>8</Tabs.Count>
    </Tabs.Item>
    <Tabs.Item value="comments">
      <Tabs.Label>Comments</Tabs.Label>
      <Tabs.Count>12</Tabs.Count>
    </Tabs.Item>
  </Tabs.List>
  <Tabs.Content value="overview">Project summary, milestones and recent activity.</Tabs.Content>
  <Tabs.Content value="members">Everyone with access to this project.</Tabs.Content>
  <Tabs.Content value="comments">Feedback left on designs and documents.</Tabs.Content>
</Tabs>

Installation

pnpm dlx wideset add tabs

Copies the component and any Wideset components it uses into your project.

Examples

Types

Regular underlines the active tab and fits the tabs to their labels; it is the default for sections of a page. Full width shares the width evenly, for two to four tabs in a narrow panel. Pills fill the active tab, for a compact switcher. Ghost has no border: a soft background slides to the active tab, for cards and toolbars. Pills and ghost ignore divider.

tsx
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

export default function TabsTypes() {
  return (
    <div className="gap-ws-16 flex w-[24rem] max-w-full flex-col">
      {(['regular', 'fullWidth', 'pills', 'ghost'] as const).map((type) => (
        <Tabs key={type} type={type} defaultValue="overview">
          <Tabs.List>
            <Tabs.Item value="overview">
              <Tabs.Label>Overview</Tabs.Label>
            </Tabs.Item>
            <Tabs.Item value="members">
              <Tabs.Label>Members</Tabs.Label>
            </Tabs.Item>
            <Tabs.Item value="comments">
              <Tabs.Label>Comments</Tabs.Label>
            </Tabs.Item>
          </Tabs.List>
        </Tabs>
      ))}
    </div>
  );
}

Sizes

Small is the default, with a compact label for panels and dense screens. Large gives the tabs more height and a larger label, for the top level of a page; use one size per screen.

tsx
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

export default function TabsSizes() {
  return (
    <div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
      {(['sm', 'lg'] as const).map((size) => (
        <Tabs key={size} size={size} defaultValue="overview">
          <Tabs.List>
            <Tabs.Item value="overview">
              <Tabs.Label>Overview</Tabs.Label>
            </Tabs.Item>
            <Tabs.Item value="members">
              <Tabs.Label>Members</Tabs.Label>
            </Tabs.Item>
            <Tabs.Item value="comments">
              <Tabs.Label>Comments</Tabs.Label>
            </Tabs.Item>
          </Tabs.List>
        </Tabs>
      ))}
    </div>
  );
}

Icons

An icon goes before the label and is hidden from screen readers, so the label still names the tab. A count goes after the label and becomes part of the tab's accessible name; use it for how many items wait behind the tab, not for a status. Give every tab an icon or none.

tsx
import { RiChat3Line, RiFileList3Line, RiTeamLine } from '@remixicon/react';
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

export default function TabsIcons() {
  return (
    <div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
      <Tabs defaultValue="overview">
        <Tabs.List>
          <Tabs.Item value="overview">
            <Tabs.Icon icon={RiFileList3Line} />
            <Tabs.Label>Overview</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="members">
            <Tabs.Icon icon={RiTeamLine} />
            <Tabs.Label>Members</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="comments">
            <Tabs.Icon icon={RiChat3Line} />
            <Tabs.Label>Comments</Tabs.Label>
          </Tabs.Item>
        </Tabs.List>
      </Tabs>
      <Tabs defaultValue="overview">
        <Tabs.List>
          <Tabs.Item value="overview">
            <Tabs.Label>Overview</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="members">
            <Tabs.Label>Members</Tabs.Label>
            <Tabs.Count>8</Tabs.Count>
          </Tabs.Item>
          <Tabs.Item value="comments">
            <Tabs.Label>Comments</Tabs.Label>
            <Tabs.Count>12</Tabs.Count>
          </Tabs.Item>
        </Tabs.List>
      </Tabs>
    </div>
  );
}

States

disabled on one Tabs.Item takes that tab out of the keyboard order while the others keep working; disabled on Tabs disables every tab at once. Keep a disabled tab only when the user can tell why it is unavailable.

tsx
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

export default function TabsStates() {
  return (
    <div className="gap-ws-12 flex w-[24rem] max-w-full flex-col">
      <Tabs defaultValue="overview">
        <Tabs.List>
          <Tabs.Item value="overview">
            <Tabs.Label>Overview</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="members" disabled>
            <Tabs.Label>Members</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="comments">
            <Tabs.Label>Comments</Tabs.Label>
          </Tabs.Item>
        </Tabs.List>
      </Tabs>
      <Tabs disabled defaultValue="overview">
        <Tabs.List>
          <Tabs.Item value="overview">
            <Tabs.Label>Overview</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="members">
            <Tabs.Label>Members</Tabs.Label>
          </Tabs.Item>
          <Tabs.Item value="comments">
            <Tabs.Label>Comments</Tabs.Label>
          </Tabs.Item>
        </Tabs.List>
      </Tabs>
    </div>
  );
}

API reference

Tabs

NameDescriptionDefault
defaultMotion

Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`.

boolean
true
disabled

Disables all tab items. Individual items can still be disabled via `Tabs.Item`.

boolean
false
divider

Whether to render a bottom border beneath the tab list. Ignored when `type` is `pills` or `ghost`.

boolean
true
size

Size of the tabs, controls label typography and padding.

'sm''lg'
'sm'
type

Visual style variant of the tabs. - `regular` — underline indicator, tabs aligned to content width - `fullWidth` — underline indicator, tabs stretch to fill the container - `pills` — pill-shaped tabs with background fill on the active item - `ghost` — borderless tabs; a soft background slides to the active item

'ghost''regular''fullWidth''pills'
'regular'
Every other prop of Radix Tabs.Root is passed through to it. See Radix Tabs.Root.

Tabs.Content

No props of its ownIt takes its content as children.
Every other prop of Radix Tabs.Content is passed through to it. See Radix Tabs.Content.

Tabs.Count

NameDescriptionDefault
children

Count displayed inside the badge.

ReactNode
—
className

Additional CSS classes for layout overrides.

string
—

Tabs.Item

NameDescriptionDefault
value*

The value that identifies this tab.

string
—
disabled

Disables this specific tab item. Overrides the parent `Tabs` `disabled` prop.

boolean
—
Every other prop of Radix Tabs.Trigger is passed through to it. See Radix Tabs.Trigger.

Tabs.List

No props of its ownIt takes its content as children.
Every other prop of Radix Tabs.List is passed through to it. See Radix Tabs.List.

Accessibility

  • Radix gives the tablist / tab / tabpanel roles and arrow-key navigation; use the parts, not plain buttons.
  • Tabs.Icon is hidden from screen readers; the label names the tab. Do not ship icon-only tabs.
PartRendersDescription
TabsRadix Tabs.RootNamed sections displayed one at a time.
Tabs.ContentRadix Tabs.ContentThe content surface rendered within `Tabs`.
Tabs.Count—A count displayed beside a tab label.
Tabs.ItemRadix Tabs.TriggerAn individual item within `Tabs`.
Tabs.ListRadix Tabs.ListThe container arranging tab triggers.
Project summary, milestones and recent activity.
tsx
import { Tabs } from '@/components/ui/wideset/tabs/Tabs';

<Tabs defaultValue="overview">
  <Tabs.List>
    <Tabs.Item value="overview">
      <Tabs.Label>Overview</Tabs.Label>
    </Tabs.Item>
    <Tabs.Item value="members">
      <Tabs.Label>Members</Tabs.Label>
      <Tabs.Count>8</Tabs.Count>
    </Tabs.Item>
    <Tabs.Item value="comments">
      <Tabs.Label>Comments</Tabs.Label>
      <Tabs.Count>12</Tabs.Count>
    </Tabs.Item>
  </Tabs.List>
  <Tabs.Content value="overview">Project summary, milestones and recent activity.</Tabs.Content>
  <Tabs.Content value="members">Everyone with access to this project.</Tabs.Content>
  <Tabs.Content value="comments">Feedback left on designs and documents.</Tabs.Content>
</Tabs>

Appearance

Type
Size
Divider

Content

Icons
Counts

State

Disabled