Talisman LogoTalisman Logo Design System
Browse documentation
Components

Tabs

A set of views of the same content, one visible at a time, switched with a row of tabs, built on Radix Tabs.

Stableimport { Tabs } from "@repo/ui/tabs";Source

12 documentos anexados ao processo, entre eles a petição inicial e a contestação.

Select a tab, or focus the row and use the arrow keys.

When to use

  • To split one page into 2 to 6 related sections the user compares or switches between: documents, tasks and history of a process.
  • When the sections share the same page header and context, and only one needs to be on screen at a time.
  • When the user should not lose their place on the page when switching.

When not to use

  • Moving between pages or steps of a flow. Use links in the Sidebar, or a Breadcrumb for hierarchy.
  • Choosing a value in a form. Use a Radio group, or a Select.
  • Filtering a list. Use Radio filter or filter controls.
  • Content the user must read in sequence. Use sections on the same page.

Anatomy

Part Role
Tabs Holds the active tab. Use defaultValue or value and onValueChange.
TabsList The row of triggers. Name it with aria-label.
TabsTrigger One tab. Its value links it to the content.
TabsContent The panel for one value. Only the active panel is rendered in the page.

Examples

Default

The active tab has a brand-colored underline and primary text.

12 documentos anexados ao processo, entre eles a petição inicial e a contestação.

Disabled tab

Use disabled for a section that is not available yet and say why in the other panels. A disabled tab is skipped by the arrow keys.

Contestação em elaboração. O protocolo fica disponível após a revisão.

Manual activation

With activationMode="manual" the arrow keys only move focus. Enter or Space opens the tab. Use it when each panel is expensive to load.

Autor e réu identificados na petição inicial.

States

State Look
Default Secondary text, transparent underline.
Hover Surface background on the top corners.
Active Primary text, brand underline.
Focus Focus ring with a 2px offset, on keyboard focus only.
Disabled Not clickable, text at half opacity.

Content

  • Use one or two words, as nouns: “Documentos”, “Tarefas”, “Histórico”.
  • Keep labels the same length where you can, so the row reads evenly.
  • Do not repeat the same word in every tab (“Ver documentos”, “Ver tarefas”).
  • Name the row with a translated aria-label on TabsList, such as “Seções do processo”.

Do and don’t

DoUse short nouns that name the section.
Don'tDon't write instructions as labels. The row grows and users have to read every tab.

Accessibility

  • Built on Radix Tabs. TabsList has role="tablist", each trigger role="tab" with aria-selected, and each panel role="tabpanel" linked to its trigger with aria-controls and aria-labelledby.
  • Tab moves focus into the list on the active trigger, and out of it to the active panel. Only the active tab is in the tab order (roving tabindex).
  • Left and Right arrow keys move between triggers and loop at the ends. Home and End go to the first and last. With orientation="vertical" the keys are Up and Down.
  • In automatic mode the focused tab activates at once. In manual mode, Enter or Space activates it.
  • Disabled triggers are skipped by the arrow keys.
  • Each trigger is about 33px tall, above the 24px minimum.
  • Give the tab list an accessible name (aria-label): the component does not.

Code

import { Tabs, TabsContent, TabsList, TabsTrigger } from "@repo/ui/tabs";

<Tabs defaultValue="documents">
  <TabsList aria-label="Seções do processo">
    <TabsTrigger value="documents">Documentos</TabsTrigger>
    <TabsTrigger value="tasks">Tarefas</TabsTrigger>
  </TabsList>
  <TabsContent value="documents">…</TabsContent>
  <TabsContent value="tasks">…</TabsContent>
</Tabs>;

Props

Tabs
PropTypeDefaultDescription
activationMode"automatic" | "manual"automatic`automatic` activates a tab when it receives focus; `manual` waits for `Enter` or `Space`
defaultValuestring—Value of the tab that is active on first render
onValueChange(value: string) => void—Called when the active tab changes
orientation"horizontal" | "vertical"horizontalDirection of the arrow keys that move between tabs
valuestring—Controlled value of the active tab
TabsTrigger
PropTypeDefaultDescription
valuestring—Required. Identifies the tab and links it to its TabsContent.
disabledbooleanfalsePrevents the tab from being selected.
TabsContent
PropTypeDefaultDescription
valuestring—Required. Matches the value of its trigger. Shown only while that tab is active.
forceMounttrue—Keeps the panel in the page while it is inactive.
TabsList
PropTypeDefaultDescription
aria-labelstring—Accessible name of the tab list. Pass translated copy.
loopbooleantrueWhether the arrow keys wrap around at the ends.

Known issues

Issue Effect
TabsContent sets focus-visible:ring-0, and Radix makes the panel focusable. Pressing Tab from the list lands on the panel with no visible focus indicator.
The pressed state is active:bg-[rgba(0,0,0,0.1)], a hardcoded translucent color. A black overlay at 10% opacity: it does not follow the theme tokens and has little effect on dark backgrounds.
Disabled triggers use disabled:opacity-50. A translucent fill: the repository avoids transparency, and the label contrast drops below AA.
TabsList sets its border with an arbitrary value, border-[hsl(var(--stroke-tertiary))]. It bypasses the named border token classes.
TabsTrigger sets size and weight with raw classes (text-sm font-medium), not Typography. The text does not follow the type scale tokens.
Edit this page on GitHub