Tab
Single registered tab inside an OrigamTabs tablist — renders the label text and optional leading/trailing icons.
Aperçu
Rendu de l’aperçu en cours…
defaultRendu de l’aperçu en cours…
with iconRendu de l’aperçu en cours…
disabledStructure
Anatomie
Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.
<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
Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et 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
Emplacements de contenu exposés par ce composant.
- #default
- Default slot for the tab label. Receives group-item context props for custom rendering.
API
Emits
Événements émis par ce composant.
- @group:selected{ value: boolean }
API
Membres exposés
Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.
- <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.
Personnalisation
Variables CSS
Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.
- 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
Accessibilité
Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.
Rôles ARIA
Interactions clavier
| Touche | 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.
Fondation
Design tokens
Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.
- 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.
Interactif
Playground
Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.
Rendu de l’aperçu en cours…
Usage
Exemples
Extraits de code prêts à coller dans vos templates.
Basic tabs
Tabs with icons
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.