Clinia UI

Tabs

Switches between views of the same subject without leaving the page.

shadcn docs →

When to use

  • Two to five views of the same subject, shown one at a time: a source's overview, records, and settings.
  • Content that doesn't need to be compared side by side.

When not to use

  • Steps of a flow users move through in order: use one page per step, or a form with Field groups.
  • Changing a filter or a mode on the same content: use Toggle Group.
  • Moving between pages of the app: use Navigation Menu or Sidebar.
  • Splitting one form across views: users miss required fields in tabs they never opened. Keep the form on one page.

Install

npx shadcn@latest add @clinia/tabs

Patient overview and key metrics.

Anatomy

Montreal clinic: 3 sources, synced today.
  1. 1Listdata-slot="tabs-list"bg-muted · rounded-lg
  2. 2Active tab[data-slot=tabs-trigger][data-active]bg-background · text-foreground
  3. 3Tab[data-slot=tabs-trigger]:not([data-active])text-sm · text-muted-foreground
  4. 4Paneldata-slot="tabs-content"text-sm

Clinia rules

  • default is a segmented group on bg-muted: the active tab lifts to bg-background with text-foreground, and the others stay text-muted-foreground.
  • line underlines the active tab in foreground, with no background. Use it for page-level tabs.
  • Labels are one or two words, sentence case, and name the view: Overview, Records, Settings. Keep them on one line.
  • Tabs switch views. They never save, submit, or move a flow forward.

Do and don't

Do name each tab after the view it shows.
Don't turn the steps of a flow into tabs.

States

default
line
disabled tab
vertical
focus

Focus cells apply the component's focus-visible classes statically. Toggle the site theme to review both themes.

Accessibility

Built in

  • A trigger's border is transparent by default, so its focus-visible state pairs the Trust ring with an extra solid outline-ring to stay visible.
  • The list is one tab stop. Arrow keys move between tabs and loop at the ends.
  • A tab shows its panel on Enter or Space, not on focus, unless activateOnFocus is set on TabsList.

Your responsibility

  • Give TabsList an aria-label when no visible heading names the set of views.
  • Keep each label unique. Two tabs named Details can't be told apart when read aloud.

How to test

  1. Press Tab: focus lands on the active tab and the ring appears. Press Tab again: focus moves into the panel, not to the next tab.
  2. Press Arrow Right and Arrow Left: focus moves between tabs and wraps at the ends.
  3. Press Enter or Space on a focused tab: its panel shows.
  4. With a screen reader, a tab is announced as its label, a tab, its position in the list, and selected when active.

API

TabsList

PropValuesDefaultDescription
variant
defaultline
default

default is a segmented group on bg-muted; line underlines the active tab, for page-level tabs.

All other props come from Base UI Tabs.