Tabs
A component that organizes content into multiple sections, displaying one section at a time. Implements the ARIA tabs pattern for proper accessibility support.
Can be controlled or uncontrolled
Supports horizontal/vertical orientation
Supports automatic/manual activation
Full keyboard navigation
Architecture
Reference
-
Root
The root container that manages the state and behavior of the tabs system. Coordinates the interaction between triggers, content panels, and the optional indicator.
-
Attributes
- default-valuestring/default: -
The initial active tab when rendered. Use when you do not need to control the active tab state.
- directionenum/default: ltr
The reading direction of the tabs. Affects the keyboard navigation and visual presentation.
- manual-modeboolean/default: false
When
true
, tab panels are only activated by clicking the tab trigger. Whenfalse
, tab panels activate automatically when their triggers receive focus. - orientationenum/default: horizontal
The orientation of the tab list. Affects keyboard navigation and visual layout of the tabs.
- valuestring/default: -
The controlled active tab value. Must be used in conjunction with
onValueChange
.
-
-
Events
- onValueChange
Event handler called when the active tab changes.
-
-
Classes
- direction-rtl
Applied when the reading direction is right-to-left.
- orientation-vertical
Applied when the tab list orientation is vertical.
-
-
-
List
The container for tab triggers that provides proper keyboard navigation and ARIA attributes. Manages focus behavior and keyboard interactions between tabs.
-
Attributes
- aria-labelstring/default: -
Accessible label for the tab list when a visible label is not present.
- aria-labelled-bystring/default: -
References the ID of the element that labels the tabs list.
- idstring/default: -
ID that is forwarded to the underlying container for DOM manipulation.
- loopboolean/default: true
When
true
, keyboard navigation will loop from last tab to first and vice versa.
-
-
Classes
- orientation-vertical
Applied when the tab list orientation is vertical.
-
-
-
Trigger
A wrapper component that must contain an
sc-button
. The button controls the visibility of its associated tab panel and automatically receives the appropriate ARIA attributes.-
Attributes
- disabledboolean/default: false
When
true
, prevents the user from interacting with the tab. - valuestring/default: -
A unique value that associates this trigger with its corresponding content panel.
-
-
-
Indicator
An optional visual element that highlights the currently selected tab. By default, it automatically positions and sizes itself to match the active tab trigger.
-
Content
The container that holds the content for a specific tab panel. Content is shown when its corresponding trigger is active and automatically receives proper ARIA attributes.
-
Attributes
- idstring/default: -
ID that is forwarded to the underlying container for DOM manipulation.
- valuestring/default: -
A unique value that associates this content with its corresponding trigger. Content is displayed when this value matches the active tab value.
-
-
Keyboard
- Tab
When focus enters the tab list, focuses the active trigger. When a trigger is focused, moves focus to the active content panel.
-
When
vertical
, moves focus to the next trigger and activates its associated content unlessmanual-mode
is enabled. -
When
vertical
, moves focus to the previous trigger and activates its associated content unlessmanual-mode
is enabled. -
When
horizontal
, moves focus to the next trigger inltr
or the previous trigger inrtl
, and activates its associated content unlessmanual-mode
is enabled. -
When
horizontal
, moves focus to the previous trigger inltr
or the next trigger inrtl
, and activates its associated content unlessmanual-mode
is enabled. - Home
Moves focus to the first trigger and activates its associated content.
- End
Moves focus to the last trigger and activates its associated content.