Tabs
moleculesWAI-ARIA tabs with an animated indicator: a tablist over one panel, or a standalone document strip with counts, icons, closable tabs and trailing actions.
Service detail
tabs with icon and count, bind:value, and a panel snippet that receives the active id.
- Region
- eu-west-1
- Role
- worker
- CPU
- 87%
- Uptime
- 3 days
Panel padding and strip-only
panelPadding="none" | "sm" | "md"; without a panel the tablist stands alone as a strip.
States
a disabled tab is skipped by ←/→; long labels truncate at tabMaxWidth and the strip scrolls when it overflows.
Closable document strip
closable with onclose; the ✕, Delete and middle-click close a tab, a pinned tab opts out with closable: false; leading and actions snippets.
Micro-interactions
data-fx-tabs on any ancestor: "pill" (default) slides a raised pill, "stretch" stretches the line across, "ink" spreads from the click point, "none" keeps the plain line.
Survives a reload
href={(id) => tab.href(id)} renders real links (middle-click opens the tab in a new tab); urlState keeps bind:value in the ?tab= param, so a refresh or a shared link lands on the same tab.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
tabs required | TabItem[] | — | |
value bindable | string | — | |
label | string | 'Tabs' | |
href | (id: string) => string | — | Tabs become real links (`<a aria-current>`): middle-click opens the tab's URL in a new tab. |
panel | Snippet<[string]> | — | Content for the active tab. Omit it for a strip-only tablist. |
closable | boolean | false | Every tab gets a close control; Delete and middle-click close too. |
onclose | (id: string) => void | — | Called with the tab id; the caller removes it from `tabs`. |
closeLabel | string | 'Close tab' | Accessible name of each close control. |
tabMaxWidth | string | — | Widest a tab may grow before its label truncates (any CSS length). |
leading | Snippet<[TabItem]> | — | Rendered before the icon and label of every tab (a status dot, a number). |
actions | Snippet | — | Trailing controls after the strip (close all, new tab). |
class | string | '' | |
style | string | '' | |
panelClass | string | '' | |
panelPadding | 'none' | 'sm' | 'md' | 'md' | |
sound | boolean | true | Play UI sounds when enabled globally; false silences this instance. |