Koala logo Design
Esc
No matches for “
↑↓ navigate open Esc close
Components Segmented control

Segmented control

Generic segmented pill control with a sliding active thumb. Use for any 2–5 option group where a horizontal segmented control reads better than a dropdown — period filters, timeframe pickers, view-mode toggles.

<koala-segmented-control>

Canonical — period filter

Three options — view switcher

Two options — yes / no

For yes/no questions inside forms (with model binding), prefer <koala-radio-yes-no> — segmented-control is a navigation control, not a form field.

Props

Attribute Values Notes
optionsIReadOnlyList<SliderOption>Required. Each option is a (Key, Label) pair.
active-keyStringRequired. Must match one option's Key; the helper throws otherwise.
base-urlURLEach option link appends ?{query-param}={key}.
target-idStringAlpine-AJAX swap target. Default main.
query-paramStringURL parameter name. Default period.

Do & don't

3 options — a real segmented control
Do Use slider select for 2–4 mutually-exclusive options where every value is short enough to read at a glance.
7 options stretched across the bar with text overflowing
Don't Don't reach for slider select when the option count or label length doesn't fit. Use <koala-dropdown> or a regular <koala-tabs> instead.