React

Segmented Control

A component used to select one of multiple options to immediately filter or switch related content.

Available since@seed-design/react@0.0.1, @seed-design/css@0.0.1

Installation

npx @seed-design/cli@latest add ui:segmented-control

Props

SegmentedControl

You must provide at least one of value or defaultValue.

Prop

Type

disabled?boolean | undefined
name?string | undefined
form?string | undefined
value?string | undefined
defaultValue?string | undefined
onValueChange?((value: string) => void) | undefined

SegmentedControlItem

Prop

Type

inputProps?React.InputHTMLAttributes<HTMLInputElement> | undefined
rootRef?React.Ref<HTMLLabelElement> | undefined
notification?boolean | undefined
valuestring
disabled?boolean | undefined
invalid?boolean | undefined

Examples

Disabled

Notification

Long Label

Fixed Width

You can directly set the width by providing width to the style prop of SegmentedControl.

Listening to Value Changes

You can detect selection value changes using the onValueChange prop of SegmentedControl.

If you need to use events, you can add event handlers directly to the internal <input> element through the inputProps of SegmentedControlItem.

Table of contents