Tabs
Switch between related views with segmented or underlined tabs.
Recommended API
| Property or element | Type | Example initial value | Description |
|---|---|---|---|
aria-selected | ARIA Boolean | Overview selected | Expose the active tab. |
aria-controls and aria-labelledby | Element IDs | Per instance and tab | Associate each tab with its panel in both directions. |
States
| State | Trigger | Result |
|---|---|---|
selected | Click a tab or use Left, Right, Home or End. | The selected tab and its panel change together. |
Svelte implementation guidance
Select a tab with a click or the arrow keys. Home and End move to the first and last tab. Inactive panels stay mounted and hidden.
First reuse a suitable existing project tabs component or UI library through its public API, adapting the Quark CSS to its styling hooks. The following is guidance only when a custom implementation is needed. Use the project's Svelte version and conventions. Suggested tabs props: `items` with stable string values and labels, `label: string`, `value?: string`, `defaultValue?: string`, and `onValueChange?: (value: string) => void`; provide panel content with the project's native snippets or slots. Use reactive state for uncontrolled selection and DOM references for focus. Generate stable instance IDs compatible with SSR and hydration.
CSS variables
| Variable | Type | Default | Description |
|---|---|---|---|
--q-text | color | #28302a | Main text and foreground color. |
--q-muted | color | #70776f | Color for secondary text. |
--q-font-size | length | 13px | Base size for the component text. |
--q-accent | color | #344e41 | Accent for active controls, indicators and focus. |
--q-surface | color | #ffffff | Surface for controls and cards. |
--q-border | color | #dce0d8 | Color for outlines and dividers. |
--q-radius | length | 10px | Base corner radius. |
--q-space | length | 4px | Base unit for gaps and padding. |
--q-gap | length | calc(var(--q-space) * 2) | Space between items, based on the spacing unit. |
--q-control-py | length | calc(var(--q-space) * 2.5) | Vertical padding for controls. |
--q-shadow | shadow | 0 4px 16px rgb(0 0 0 / 8%) | Shadow behind raised elements. |
--q-duration | time | 175ms | Duration of visual state transitions. |