Sajari UI

SegmentedControl

A segmented control is a linear set of two or more segments, each of which functions as a mutually exclusive button. Within the control, all segments are equal in width. Like buttons, segments can contain text or images. Segmented controls are often used to display different views.

Import

Usage

Basic usage of SegmentedControl and ControlSegment.

Editable Example

Sizes

The default size is md but it's possible to use sm and lg versions using the size prop.

Editable Example
Editable Example

Props

SegmentedControl Props

SegmentedControl composes the RadioButtonGroup component but excludes the spacing and inline props.

NameTypeDefaultDescription
idstringThe id of the checkbox group.
namestringThe name of the input field in a radio (useful for form submission).
defaultValuestringThe initial value of the radio group.
valueRadioProps['value']The value of the radio group.
onChangefunctionThe callback fired when any children Radio is checked.

ControlSegment Props

NameTypeDefaultDescription
valuestring or numberThe value to be used for the segment. This is the value that will be returned on form submission.
disabledbooleanIf true, the segment will be disabled.
loadingbooleanIf true, a spinner will be displayed before any child elements.
childrenReact.ReactNodeThe child elements.
iconIconProps['name']An icon to display before any children.
iconSizeIconProps['size']The size of the icon to display before any children.