Segmented control

A segmented control is a short row of options where exactly one is on. It swaps a panel, picks a value or filters a view at once.

Previewapps/web/components/ui/KbSegmented.tsx

Swap a panel

Use kind="tabs" when the options switch what is shown below. The panel names its tab with aria-labelledby.

Show code
<KbSegmented label="Editor view" kind="tabs" value={mode} onChange={setMode} options={options} />

Pick a value

Use kind="radio" for a setting with two to four values.

Show code
<KbSegmented label="Access" kind="radio" value={access} onChange={setAccess} options={options} />

Filter a view

Use kind="toggle" (the default) when the options narrow a list. Each option is a pressed button.

Show code
<KbSegmented label="Show" value={filter} onChange={setFilter} options={options} />