structyl

Tabs

stable

A set of layered sections of content — known as tab panels — displayed one at a time.

Basic usage

Make changes to your account here.

Examples

Three tabs

Multiple tabs for account, password, and billing settings.

Make changes to your account here.

Account settings layout

Tabs can organize forms and large detail panels without leaving the page.

Semantic colors

Pass color to Tabs.Root to use a semantic accent for the active indicator.

Features

  • Can be controlled or uncontrolled.
  • Supports horizontal/vertical orientation.
  • Supports automatic and manual activation.
  • Full keyboard navigation.

Installation

bash
pnpm dlx structyl add tabs

API Reference

Tabs.Root

Contains the tab list and panels.

PropTypeDefault
valuestring

Controlled active tab.

defaultValuestring

Initial active tab.

onValueChange(value: string) => void

Called when the active tab changes.

orientation'horizontal' | 'vertical'

Layout axis.

'horizontal'
activationMode'automatic' | 'manual'

Whether focusing a tab activates it.

'automatic'
dir'ltr' | 'rtl'

Reading direction.

Tabs.List

The container of tab triggers.

PropTypeDefault
loopboolean

Whether arrow navigation wraps.

true

Tabs.Trigger

Activates its associated panel.

PropTypeDefault
valuestring

Links the trigger to its content.

disabledboolean

Disable this tab.

false

Tabs.Content

The panel for a given value.

PropTypeDefault
valuestring

Links the content to its trigger.

forceMountboolean

Force mounting for animation control.

Keyboard interactions

Adheres to the WAI-ARIA design pattern .

KeyDescription
TabMoves focus to the active trigger, then the panel.
ArrowLeft / ArrowRightMoves to the previous / next tab.
Home / EndMoves to the first / last tab.
Tabs | structyl