Components / Navigation / Pill tabs

N4 · Navigation

Pill tabs

A single-select tab row. The hash records the open tab.

When to use

  • One list has a few named slices.
  • The open slice should survive a refresh.

When not to use

  • The slices are a form with several answers at once.
  • There are only two choices and no list under them. Use a segmented control.

Usage

<div class="c-tabs" role="tablist">
  <button type="button" class="c-tab" role="tab" data-hash="queue" aria-selected="true">Queue<span class="c-count">2</span></button>
  <button type="button" class="c-tab" role="tab" data-hash="review" aria-selected="false">In review<span class="c-count">4</span></button>
</div>

Variants

The preview shows the form used in the gallery.

Props

NameTypeDefaultDescription
data-hashtoken—Hash written when the tab is selected.
aria-selectedtrue or falsefalseThe open tab.
aria-controlsid—Panel this tab shows.
c-counttext—Count, set in tabular numbers.

Keyboard

KeyAction
ArrowLeft / ArrowRightMoves across tabs and selects.
TabLeaves the tab list.

Accessibility

Motion

Pattern origin

Pattern type: a tab row on a list, addressed by the URL hash.

Related

Filter chipsSegmented controlCalendar list