Browse the docs

Tabs

Index-card dividers. The active one comes forward and joins the page. Arrow keys move between them.

Client componentWCAG AASince v0.1

Live example

Cat in a teacup · Poster for the zine fair · Rosa’s comic, page 3

Change every prop live in the playground.

Props

Tabs

PropTypeDefaultWhat it does
childrenrequiredReactNodenoneA TabList of Tabs and a TabPanel for each.
classNamestringnoneExtra class on the wrapper.
defaultValuestringnoneUncontrolled value of the tab selected first.
onValueChange(value: string) => voidnoneCalled with the newly selected tab's value.
valuestringnoneControlled value of the selected tab.

TabList

PropTypeDefaultWhat it does
childrenrequiredReactNodenoneThe Tabs.
labelrequiredstringnoneAccessible name of the tab list, e.g. "Your sketches".
classNamestringnoneExtra class on the tab list.

Tab

PropTypeDefaultWhat it does
childrenrequiredReactNodenoneThe tab's label, lettered in Sketchpop.
valuerequiredstringnoneIdentifies the tab; matches the value of its TabPanel.
badgeReactNodenoneA count badge after the label (e.g. a <Count>).
disabledbooleanfalseGreys out the tab; it can't be picked and arrow keys skip it.

Use it well

DoUse tabs to switch between views of the same thing.
Don'tUse tabs as steps in a process. People can't tell they have to visit each one.

Accessibility

  • The WAI-ARIA tabs pattern: tablist, tabs with aria-selected and aria-controls, tabpanels.
  • Roving tabindex; Arrow keys, Home and End move and select.
Five stamps!

All aboard.

You took the whole tour. Here's Holo Pip, a foil sticker for riders who finish. It's in your playground tray now, for good.