Back to library

Tabs

Switch between related views with segmented or underlined tabs.

Everything, in one place.

Recommended API

Property or elementTypeExample initial valueDescription
aria-selectedARIA BooleanOverview selectedExpose the active tab.
aria-controls and aria-labelledbyElement IDsPer instance and tabAssociate each tab with its panel in both directions.

States

StateTriggerResult
selectedClick 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

VariableTypeDefaultDescription
--q-textcolor #28302aMain text and foreground color.
--q-mutedcolor #70776fColor for secondary text.
--q-font-sizelength 13pxBase size for the component text.
--q-accentcolor #344e41Accent for active controls, indicators and focus.
--q-surfacecolor #ffffffSurface for controls and cards.
--q-bordercolor #dce0d8Color for outlines and dividers.
--q-radiuslength 10pxBase corner radius.
--q-spacelength 4pxBase unit for gaps and padding.
--q-gaplength calc(var(--q-space) * 2)Space between items, based on the spacing unit.
--q-control-pylength calc(var(--q-space) * 2.5)Vertical padding for controls.
--q-shadowshadow 0 4px 16px rgb(0 0 0 / 8%)Shadow behind raised elements.
--q-durationtime 175msDuration of visual state transitions.