Tab

Navigation
stable

Single registered tab inside an OrigamTabs tablist — renders the label text and optional leading/trailing icons.

Preview

Rendering the live preview…

default

Rendering the live preview…

with icon

Rendering the live preview…

disabled

Structure

Anatomy

Visual breakdown of the component's internal structure with BEM class call-outs.

Anatomy of OrigamTabSchematic of the Tab component with 4 numbered internal parts. icon Label / #default slot append icon 1 2 3 4 5 origam-tab ② prepend · ③ label · ④ append — flex row; ⑤ indicator — abs bottom
Anatomy of <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. Carries role="tab", aria-selected, aria-controls and managed tabindex.
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 text prop).
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 --active via CSS transform.

API

Props

All props accepted by this component, with their type, default value and description.

tag
string
'button'
Root HTML element. Defaults to button for keyboard accessibility.
text
string
''
Label text rendered inside the tab. Can also be provided via the default slot.
variant
TTabVariant
Visual variant inherited from the parent OrigamTabs. Controls indicator and pill rendering.
icon
Leading icon displayed before the label text.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
value
any
Canonical identifier for this tab. Must match the value prop on the sibling OrigamTabPanel.
disabled
boolean
false
Disables the tab. Sets aria-disabled and tabindex=-1; prevents click activation.
selectedClass
string
'origam-tab--active'
CSS class added to the tab root when it is the active selection.
color
TColor
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
appendAvatar
string
appendIcon
Trailing icon displayed after the label text.
prependAvatar
string
prependIcon
TIcon
prependAriaLabel
string
appendAriaLabel
string

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

tab

Keyboard interactions

Keyboard interactions
KeyAction
Enter / SpaceActivates the tab (selects it in the group).
ArrowLeft / ArrowRightMoves focus to the previous / next tab in the tablist (roving tabindex managed by OrigamTabs).
TabMoves 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.

Source
color
var(--origam-color__text---secondary)
Resting label color.
dimension
var(--origam-space---12)
Minimum tab height.
fontWeight
var(--origam-font__weight---medium)
Resting label font weight.
duration
var(--origam-motion__duration---fast)
Transition duration for color and background changes.
color
var(--origam-color__action--primary---bg)
Underline indicator color for variant="underline".
dimension
var(--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

vue

Tabs with icons

vue

Ecosystem

Family

Components from the same folder that share conventions and often compose together.