Tabs

A rendeless component for organize content into sections. Switch between views by clicking tab trigger. Supports active state, dynamic content, and keyboard navigation and more.

View source

API Reference

TabRoot

PropertyTypeDefaultDescription
children Snippet
Snippet
Tab Root content to render
disabled
boolean
falseDisable all tabs
loop
boolean
falseLoop when navigating with the keyboard
onValueChange
TabsSelectionValueChange
Callback when value change
orientation
union
"horizontal"Tabs orientation
selectWhenFocused
boolean
trueActivate tabs when focused
value $bindable
TabsSelectionValue
Current active tab value

TabList

PropertyTypeDefaultDescription
children Snippet
Snippet
Tab List content to render

TabTrigger

PropertyTypeDefaultDescription
children Snippet
Snippet
Tab trigger content to render
disabled
boolean
falseDisable tab
value required
TabsValue
Unique Tab identifier. Must be the same as TabContent value

TabContent

PropertyTypeDefaultDescription
children Snippet
Snippet
Tab content to render
value required
TabsValue
Unique Tab identifier. Must be the same as TabTrigger value

Type Definitions

export type TabsSelectionValueChange = (value: TabsSelectionValue) => void;

export type TabsRootSnippetProps = {
    readonly orientation: Orientation;
    readonly attrs: Record<string, unknown>;
};

export type TabsListSnippetProps = {
    readonly orientation: Orientation;
    readonly attrs: Record<string, unknown>;
};

export type TabsTriggerSnippetProps = {
    readonly active: boolean;
    readonly disabled: boolean;
    readonly orientation: Orientation;
    readonly attrs: Record<string, unknown>;
};

export type TabsContentSnippetProps = {
    readonly active: boolean;
    readonly disabled: boolean;
    readonly orientation: Orientation;
    readonly attrs: Record<string, unknown>;
};

Examples

Vertical

Example using other components from the library.

In controlled mode and with multiple/loop enabled.

v0.0.13