ttolbel UI

Component

Segmented control

A row of mutually exclusive text options with a glowing dot that magnet-slides beneath whichever one is active.

The primitive

segmented control.tsx
<NativeSegmentedControl
  options={[
    { label: "Day", value: "day" },
    { label: "Week", value: "week" },
    { label: "Month", value: "month" },
  ]}
  value={value}
  onValueChange={setValue}
/>

Example

Switches the time range above a balance chart, redrawing the chart the instant a new segment is selected.

segmented-control-example.tsx
<NativeSegmentedControl options={rangeOptions} value={range} onValueChange={setRange} />
<BalanceChart range={range} />

Capabilities

PropTypeDescription
optionsrequiredNativeSegmentedControlOption[]
valuerequiredstring
onValueChangerequired(value: string) => void
surfaceNativeSegmentedControlSurface
classNamestring
scrollYMotionValue<number>Optional MotionValue<number> from useScrollCollapse's scrollY. When provided the control compresses as the user scrolls up.