Tab
Single registered tab inside an OrigamTabs tablist — renders the label text and optional leading/trailing icons.
Preview
Rendering the live preview…
defaultRendering the live preview…
with iconRendering the live preview…
disabledStructure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-tab> — 5 internal parts. The indicator (⑤) is absolute-positioned at the block-end and scales on activation.- 1.origam-tab
- Root element. Renders as
<button>by default. Carriesrole="tab",aria-selected,aria-controlsand managedtabindex. - 2.origam-tab__prepend
- Leading icon area. Rendered with
v-if="icon". Wraps an<OrigamIcon>. - 3.origam-tab__label
- Label zone. Contains the default slot (falls back to the
textprop). - 4.origam-tab__append
- Trailing icon area. Rendered with
v-if="appendIcon". - 5.origam-tab__indicator
- Absolute underline indicator. Visible only when
variant="underline". Scales from 0 → 1 on--activevia CSS transform.
API
Props
All props accepted by this component, with their type, default value and description.
- tagstring'button'
- Root HTML element. Defaults to button for keyboard accessibility.
- textstring''
- Label text rendered inside the tab. Can also be provided via the default slot.
- variantTTabVariant
- Visual variant inherited from the parent OrigamTabs. Controls indicator and pill rendering.
- icon
- Leading icon displayed before the label text.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- valueany
- Canonical identifier for this tab. Must match the value prop on the sibling OrigamTabPanel.
- disabledbooleanfalse
- Disables the tab. Sets aria-disabled and tabindex=-1; prevents click activation.
- selectedClassstring'origam-tab--active'
- CSS class added to the tab root when it is the active selection.
- colorTColor
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
- appendAvatarstring
- appendIcon
- Trailing icon displayed after the label text.
- prependAvatarstring
- prependIconTIcon
- prependAriaLabelstring
- appendAriaLabelstring
API
Slots
Content slots exposed by this component.
- #default
- Default slot for the tab label. Receives group-item context props for custom rendering.
API
Emits
Events emitted by this component.
- @group:selected{ value: boolean }
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
- () => void
- Toggles the selected state of this tab in the group.
- (value: boolean) => void
- Programmatically selects (true) or deselects (false) this tab.
- Ref<string>
- Reactive CSS string generated by useStyle from the computed tab styles.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Tab label color in resting state.
- Tab background in resting state.
- Minimum tab height.
- Horizontal padding of each tab.
- Vertical padding of each tab.
- Gap between icon and label.
- Tab label font size.
- Tab label font weight.
- Tab label letter spacing.
- Tab border radius. Set to radius.full for pills variant.
- Transition duration for color, background-color, border-color and transform.
- Tab label color when active.
- Font weight applied to the active tab.
- Color of the underline indicator bar (variant="underline").
- Thickness of the underline indicator bar.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Enter / Space | Activates the tab (selects it in the group). |
| ArrowLeft / ArrowRight | Moves focus to the previous / next tab in the tablist (roving tabindex managed by OrigamTabs). |
| Tab | Moves focus outside the tablist to the next focusable element (tabpanel). |
Notes
- OrigamTab wires role="tab", aria-selected, aria-controls (pointing to the matching panel id) and aria-disabled automatically — no manual ARIA needed on the consumer side.
- When disabled=true the tab gets aria-disabled="true" and tabindex=-1; click events are swallowed via handleClick guard.
- Focus-visible outline is applied via :focus-visible pseudo-class (2px solid currentColor, outline-offset: -2px). Never shown on mouse click.
- The indicator transform transition should be disabled under prefers-reduced-motion: reduce via the consuming theme.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- colorvar(--origam-color__text---secondary)
- Resting label color.
- dimensionvar(--origam-space---12)
- Minimum tab height.
- fontWeightvar(--origam-font__weight---medium)
- Resting label font weight.
- durationvar(--origam-motion__duration---fast)
- Transition duration for color and background changes.
- colorvar(--origam-color__action--primary---bg)
- Underline indicator color for variant="underline".
- dimensionvar(--origam-border__width---2)
- Thickness of the underline indicator.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic tabs
Tabs with icons
Ecosystem
Family
Components from the same folder that share conventions and often compose together.