Skip to main content

Segmented

Use Segmented for a compact choice that switches a view or filter. Use Tabs when each choice owns a panel, Radio.Group for a conventional form field, or ToggleGroup when several options can be pressed at once.

import { Segmented } from '@jbpark/ui-kit';

<Segmented
aria-label="View"
options={['Grid', 'List', 'Compact']}
defaultValue="Grid"
onChange={value => console.log(value)}
/>;
Grid view

Props​

PropTypeDefaultDescription
optionsreadonly (string | { label: string; value: string; icon?: ReactNode; disabled?: boolean })[]requiredChoices in display order. Values must be unique.
valuestring-Controlled selected value.
defaultValuestringfirst enabled optionInitially selected value when uncontrolled.
onChange(value: string) => void-Called when selection changes.
size'small' | 'middle' | 'large'Config size or middleControl density.
orientation'horizontal' | 'vertical''horizontal'Layout and arrow-key direction.
disabledbooleanfalseDisable the entire group.
classNamestring-Root class.
classNames{ item?: string; activeItem?: string }-Item classes.

Supply aria-label or aria-labelledby so assistive technology can identify the group. The selected value cannot be cleared by clicking it again. When there are no enabled options, the group starts without a selection. Segmented also accepts Base UI Toggle Group root props such as dir, loopFocus, and ref.