Skip to main content

SegmentedControl

A single-choice control that shows all options at once, built on the Radix ToggleGroup in single mode.

This is a function exported by @mapcairn/map, checked against version 0.2.0.

Signature​

import { SegmentedControl } from "@mapcairn/map";

function SegmentedControl(input: SegmentedControlProps): JSX.Element;

Description​

Radix renders the group as a radiogroup and each item as a radio, which is the right semantics for a mutually exclusive choice. Focus moves between items with the arrow keys (one tab stop for the whole group) and Space or Enter chooses the focused item.

Unlike a raw toggle group, the selection can never be cleared: pressing the active item again is ignored. The selected item is filled and shows a check mark, so selection never relies on colour alone.

Parameters​

  • { label, options, value, onValueChange, disabled, className, "data-testid": testId, }
  • input (SegmentedControlProps)

Returns​

JSX.Element

See also​

Source: packages/map/src/ui/SegmentedControl/SegmentedControl.tsx:55