Skip to content

Tabs

Tabs on Base UI Tabs whose highlight glides between triggers, in default and line variants.

Default

The project is on track: 14 of 20 tasks are done.

Line

Tasks in one list, sorted by due date.

Vertical

The project name, its key and its default view.

With icons

Tasks in one list, sorted by due date.

Disabled tab

Six tasks are open.

Selecting on focus

Four tasks closed this week.

Installation

npx shadcn@latest add @khaeli/tabs

Install @khaeli/foundation first: this item's styling lives in its tokens and [data-slot] rules.

Installs with

npm packages
  • @base-ui/react ^1.7.0
  • class-variance-authority ^0.7.1

Keyboard

Tab
Moves to the selected tab, then to its panel, which is focusable.
Arrow RightArrow Left
Move focus to the next or previous tab and wrap at the ends. With orientation="vertical" the keys are Arrow Down and Arrow Up. A disabled tab takes focus but cannot be selected.
HomeEnd
Move focus to the first or last tab.
EnterSpace
Select the focused tab and show its panel. With activateOnFocus on TabsList, moving focus selects the tab straight away.

Accessible name

  • A tab is named by its text; an icon beside the text is decorative. The selected tab has aria-selected="true".
  • Each panel is named by its tab. A page with several sets of tabs should give each TabsList an aria-label.

Registry JSON

The item as the shadcn CLI reads it, with every file it ships: https://ui.khaeli.com/r/tabs.json