Skip to content

Tabs

Roving-tabindex tab strip with an accent active indicator.

View as Markdown

Preview

Three tabs

<div class="nx-tabs" role="tablist" aria-label="Example tabs"
    aria-orientation="horizontal">
  <button class="nx-tabs__item nx-tabs__item--active" type="button"
      role="tab" aria-selected="true" tabindex="0">Today</button>
  <button class="nx-tabs__item" type="button" role="tab"
      aria-selected="false" tabindex="-1">Activity</button>
  <button class="nx-tabs__item" type="button" role="tab"
      aria-selected="false" tabindex="-1">Settings</button>
</div>

API

React props (NxKit)

React (NxKit) props
PropTypeDefaultRequiredDescription
itemsstring[]RequiredTab labels.
activeIndexnumber0Selected tab index.
onChange(i:number)=>voidundefinedCalled on click or arrow-key navigation.
idBasestring"nxtab"Id prefix for tab/panel id wiring.
panelsbooleanfalseOpt-in aria-controls + matching role=tabpanel ids.

Classes

Framework-agnostic classes
ClassDescription
.nx-tabsrole=tablist row, hairline bottom border
.nx-tabs__itemrole=tab button
.nx-tabs__item--activeAccent text + underline
.nx-tabs__item--disabledDimmed, not-allowed

States

disabled item

Accessibility

  • role=tablist / role=tab + aria-selected; the tablist is one Tab stop, Left/Right (direction-aware) + Home/End move selection.
  • aria-controls is opt-in via the panels prop. Never emit it without a matching role=tabpanel (a dangling IDREF breaks the ARIA wiring it's meant to demonstrate).

Do / Don’t

  • Do: Pass panels + render matching role=tabpanel elements when tabs gate real content.Don't key any consumer CSS off `.nx-tabs span`. DS-1 changed the markup to <button role="tab">.

View in spec