Components
Mode picker
Nearby's All modes, Trains and Buses choice: three glyph segments with a circular selection.
Contract
Contract: components/mode-picker.yaml. States are drawn live by transit.js.
Loading the contract…
Variants
One form; no variants. ModePicker draws glyph-only segments in a fixed order: All modes (train-bus), Trains (train), Buses (bus). Nothing else exists.
// Do
<ModePicker label="Transit mode" value={mode} onChange={setMode} options={[
{ value: 'all', label: 'All modes', icon: 'train-bus' },
{ value: 'train', label: 'Trains', icon: 'train' },
{ value: 'bus', label: 'Buses', icon: 'bus' },
]} />
// Don't: a ModePicker for anything but Nearby's mode; use Segmented
<ModePicker label="Direction" value={dir} onChange={setDir} options={directions} />
Usage
Do
- Use it only for Nearby's mode filter: All modes, Trains, Buses.
Don't
- Don't move the map when the mode changes.
Accessibility
- A radiogroup labeled "Transit mode"; each segment is a radio named by its mode.