chrome
<tc-tabs>
Accessible tablist with one named slot per panel. Supports controlled and uncontrolled modes.
import
"@ra9/tan-compose-kit/tabs"
Props
| Name | Type | Default | Description |
|---|---|---|---|
tabs | Array<{ id: string; label: string }> | [] | The tab definitions. Each `id` corresponds to a named slot. |
active | string | (first tab's id) | The currently-active tab id. Reflects to the host. Read or set to control externally. |
Events
| Event | Detail | When |
|---|---|---|
tc-tab-change | { active: string, previous: string } | Fires when the user changes tabs (click or keyboard). |
Slots
| Slot | Description |
|---|---|
(per tab id) | One named slot per tab. For a tab with `id: "overview"`, place content in `<div slot="overview">…</div>`. |
CSS variables
| Variable | Default | Description |
|---|---|---|
--tc-tabs-fg | var(--tc-color-ink, #14171f) | Active tab + panel text color. |
--tc-tabs-fg-muted | var(--tc-color-ink-muted, #6b7280) | Inactive tab color. |
--tc-tabs-rule | var(--tc-color-rule, #ece5d3) | Bottom rule of the tab strip. |
--tc-tabs-accent | var(--tc-color-accent, #a16939) | Active tab color + underline. |
--tc-tabs-font | var(--tc-font-sans, …) | Font family. |
Examples
Basic usage
Define your tabs with tabs, then slot panel content by id.
A summary of what this thing does.
A list of props.
A list of events.
Controlled mode
active reflects to an attribute, so you can drive the component from the outside.
Default tab
Omit active and the first tab in the array is shown.
Theming
Accessibility
- Real
role="tablist"+role="tab"+role="tabpanel"structure;aria-selectedandaria-controlsare wired up correctly. - Roving focus is implemented via
tabindex— only the active tab is in the tab order; arrow keys move focus and selection between tabs. - Home / End jump to the first / last tab. Left / Right wrap at the ends.
- Inactive panels use the
hiddenattribute so screen readers skip them.