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 for the SegmentedControl.Item.

<SegmentedControl.Root defaultValue="plus">
  <SegmentedControl.Item aria-label="plus" value="plus">
    <PlusIcon />
  </SegmentedControl.Item>
  <SegmentedControl.Item 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

ComponentRoles and AttributesDescription
SegmentedControl.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".
SegmentedControl.Itemaria-disabledSets to "true" if disabled is set.
aria-readonlySets to "true" if readOnly is set.