Controls

Segmented Picker

A picker where the pill flows: one edge leaves before the other.

Preview

Installation

Terminal
npx @usefluid/cli add segmented-picker

Usage

SegmentedPicker.tsx
import { SegmentedPicker } from "./SegmentedPicker";

<SegmentedPicker
  label="Show"
  value={filter}
  onChange={setFilter}
  options={[
    { value: "all", label: "All" },
    { value: "active", label: "Active" },
    { value: "done", label: "Done" },
  ]}
/>

API reference

PropTypeDefaultDescription
labelstring—Accessible name of the group.
valuestring—The chosen option.
onChange(value) => void—
options{ value, label, ariaLabel? }[]—label can be any node, like a word and a count.

Keyboard and screen readers

A radio group: arrow keys move between options.

Notes

Use it for filters and views of the same list. Under 480 px it fills the width and the options share it.

Every colour comes from the --fluid-* variables, and the piece is yours to change.

How it is made

Each edge of the pill has its own spring. The leading edge is fast and the trailing one is slow, so the pill stretches on the way and shrinks when it arrives, like a drop. The arrow keys change the option.

For your agent

For your agent

Add Segmented Picker to my project with the Fluid library. Use SegmentedPicker for filters and tabs with up to five short options. Read my project first. Use my logo, my colours and my font through the --fluid-* variables. Keep 44px touch targets, visible focus and reduced motion. If I have no SVG logo, ask before making one up.