Tabs
The Tabs component organizes content into multiple panels, allowing users to switch between views easily. Ideal for sectioned content like settings, product details, or data categories, Tabs create a clean, accessible way to navigate related information within a single interface.
Make changes to your account here. Click save when you're done.
Structure
<div x-data="tabs"> <div x-ref="list"> <button x-data="tabTrigger('tab-1')"></button> <div x-ref="indicator" x-cloak></div> </div> <div x-data="tabContent('tab-1')"></div></div>
API Reference
x-data="tabs"
The root component containing the state and functionality.
Property | Type | Description | Default |
---|---|---|---|
initialActive | string | The initial active tab value | "" |
orientation | enum | The orientation of the tabs. Used for the arrow key control and aria-attribute | horizontal |
label | string | The label for the tabs component. The tablist element should have an aria-label. Alternatively you can add an element with x-ref="label" wich will be used for aria-labelledby. | "" |
urlSync | enum | The method for syncing the active tab with the URL, either via search parameters or hash. | false |
onActiveTabChange | function | A callback function that is called when the active tab changes | null |
x-data="tabTrigger"
A trigger element for a tab.
Property | Type | Description | Default |
---|---|---|---|
value | string | The unique value of the tab trigger to link it with a content slide | "" |
x-data="tabContent"
A content element for a tab.
Property | Type | Description | Default |
---|---|---|---|
value | string | The unique value of the tab content to link it with a trigger | "" |