Inputs

Segmented control

Single, always-selected choice. The selected segment takes the pill at once. A segment that's off can say why, as a disabled button does.

Live example

Import

Each family is its own entry point, so a page loads only what it uses.

tsx
import { SegmentedControl, SegmentedControlItem } from "@nibapp/ui/components/segmented-control";

Props

Each component's own props and variants, read from its source. What it also takes from an element or a Base UI part is named below its table.

SegmentedControl

Single-select segmented control. The selected segment takes the pill at once: nothing slides. Arrow keys move focus; Space/Enter select.

PropTypeDefaultDescription
size"sm" | "md""md"
blockboolean—

Stretch to the container; segments share the width equally.

valuestring—

The selected segment (controlled). A segmented control always has exactly one selection.

defaultValuestring—
onValueChange(value: string) => void—
aria-labelstring—

Accessible name for the group, e.g. "Permission mode".

children (required)ReactNode—

Also takes the props of Base UI's ToggleGroup, except value, defaultValue, onValueChange and multiple.

SegmentedControlItem

PropTypeDefaultDescription
value (required)string—
iconReactNode—

Leading icon. With no children the segment becomes a square icon button (needs `aria-label`).

disabledReasonstring | undefined—

Disables the segment and says why: the reason is its tooltip and its accessible description, and the segment stays in the arrow keys' path (`aria-disabled`) so a keyboard reaches it.

Also takes the props of Base UI's Toggle, except value, pressed, defaultPressed and onPressedChange.