SegmentedControl

SegmentedControl is a component used for allowing users to select one option from multiple choices.

Usage

import { SegmentedControl } from "@yamada-ui/react"
<SegmentedControl.Root>
  <SegmentedControl.Item />
</SegmentedControl.Root>

Use items

Change size

Change orientation

Make rounded

Disable

Read-Only

Control

Props

Accessibility

When using only icons in SegmentedControl.Item, set aria-label in SegmentedControl.Item's inputProps.

<SegmentedControl.Root defaultValue="plus">
  <SegmentedControl.Item inputProps={{ "aria-label": "plus" }} value="plus">
    <PlusIcon />
  </SegmentedControl.Item>
  <SegmentedControl.Item inputProps={{ "aria-label": "minus" }} value="minus">
    <MinusIcon />
  </SegmentedControl.Item>
</SegmentedControl.Root>

Keyboard Navigation

KeyDescriptionState
TabFocuses the selected item.-
ArrowLeftFocuses the previous item that is not disabled. If it's the first item, it focuses the last item that is not disabled.-
ArrowRightFocuses the next item that is not disabled. If it's the last item, it focuses the first item that is not disabled.-
ArrowUpFocuses the previous item that is not disabled. If it's the first item, it focuses the last item that is not disabled.-
ArrowDownFocuses the next item that is not disabled. If it's the last item, it focuses the first item that is not disabled.-

ARIA Roles and Attributes

ElementRoles and AttributesDescription
div.ui-segmented-control__rootrole="radiogroup"Indicates that it is a radio group.
aria-disabledSets to "true" if disabled is set.
aria-orientationSets "horizontal" or "vertical" based on the orientation value. Default is "horizontal".
label.ui-segmented-control__item > inputaria-disabledSets to "true" if disabled is set.

Similar Components

Checkbox

Checkbox is a component used for allowing users to select multiple values from multiple options.

NativeSelect

NativeSelect is a component used for allowing users to select one value from a list of options. It displays a native dropdown list provided by the browser (user agent).

Radio

Radio is a component used for allowing users to select one option from multiple choices.

Rating

Rating is a component used to allow users to provide ratings.

Switch

Switch is a component used to toggle between on and off states.

CheckboxCard

CheckboxCard is a component used for allowing users to select multiple values from multiple options.

RadioCard

RadioCard is a component used for allowing users to select one option from multiple choices.

Toggle

Toggle is a component that has two states: on or off.

Uses Components & Hooks