Skip to content
Premium & Brand

Segmented Control

Single-select toggle row with a thumb that slides between options.

Import

tsx
import { SegmentedControl, SegmentedControlItem } from "@cooud-ui/ui";
bash
npx cooud-ui add segmented-control

Examples

API Reference

Generated from the component's exported types.

SegmentedControlProps

Extends Omit<HTMLAttributes<HTMLDivElement>, "onChange" | "defaultValue">

PropTypeDefaultDescription
value
stringControlled selected value. When provided the component is fully controlled.
defaultValue
stringInitial selected value for the uncontrolled case.
onValueChange
(value: string) => voidCalled whenever the selection should change (controlled or not).
size
SegmentedControlSize"md"Density of the items. Defaults to `"md"`.
transition
TransitionSEGMENTED_THUMB_TRANSITIONOverride the thumb spring (advanced — defaults to the Cooud thumb spring).
reducedMotion
"user" | "always" | "never"How `prefers-reduced-motion` is honoured. Defaults to `"user"` (snap the thumb for users who opt out). Pass `"never"` to always slide it — e.g. a showcase that must demonstrate it — or `"always"` to force the snap.
children
ReactNode

SegmentedControlItemProps

Extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "value" | "onChange">

PropTypeDefaultDescription
value*
stringThe value this option selects. Required and unique within a group.
children
ReactNodeVisible label (text and/or icon).
disabled
booleanfalseDisable selection + skip in keyboard navigation.