---
title: SegmentedControl
description: "`SegmentedControl` is a component used for allowing users to select one option from multiple choices."
links:
- style: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/segmented-control/segmented-control.style.ts
- source: https://github.com/yamada-ui/yamada-ui/tree/main/packages/react/src/components/segmented-control
- storybook: https://yamada-ui.github.io/yamada-ui?path=/story/components-segmentedcontrol--basic
---
```tsx
ハチワレ
うさぎ
モモンガ
```
## Usage
```tsx
import { SegmentedControl } from "@yamada-ui/react"
```
```tsx
import { SegmentedControl } from "@/components/ui"
```
```tsx
import { SegmentedControl } from "@workspaces/ui"
```
```tsx
```
### Use items
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return
```
### Change size
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return (
{(size) => (
)}
)
```
### Change orientation
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return (
{(orientation) => (
)}
)
```
### Make rounded
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return (
)
```
### Disable
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return (
ハチワレ
うさぎ
モモンガ
)
```
### Read-Only
```tsx
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return (
ハチワレ
うさぎ
モモンガ
)
```
### Control
```tsx
const [value, setValue] = useState("ハチワレ")
const items = useMemo(
() => [
{ label: "ハチワレ", value: "ハチワレ" },
{ label: "うさぎ", value: "うさぎ" },
{ label: "モモンガ", value: "モモンガ" },
],
[],
)
return
```
## Uses Components & Hooks
## Props
### SegmentedControl.Root
| Prop | Default | Type | Description |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------- |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `size` | `"md"` | `"lg" \| "md" \| "sm" \| "xl"` | The size of the component. |
| `defaultValue` | - | `Y` | The initial value of the segmented control. |
| `disabled` | `false` | `boolean` | If `true`, the segmented control will be disabled. |
| `indicatorProps` | - | `SegmentedControlIndicatorProps` | Props for the indicator component. |
| `itemProps` | - | `SegmentedControlItemProps` | Props for the item component. |
| `items` | `[]` | `SegmentedControlItem[]` | If provided, generate segmented control buttons but based on items. |
| `name` | - | `string` | The HTML `name` attribute used for forms. |
| `onChange` | - | `(value: Y) => void` | The callback fired when any children radio is checked or unchecked. |
| `readOnly` | `false` | `boolean` | If `true`, the segmented control will be readonly. |
| `value` | - | `Y` | The value of the segmented control. |
### SegmentedControl.Item
| Prop | Default | Type | Description |
| ---------------- | ------- | ------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------ |
| `as` | - | `As` | The HTML element to render. |
| `asChild` | - | `boolean` | Merges its props onto its immediate child. |
| `css` | - | `CSSObject \| CSSObject[]` | The CSS object. |
| `colorScheme` | - | `"amber" \| "black" \| "blackAlpha" \| "blue" \| "cyan" \| "danger" \| "emerald" \| "error" \| "flashy" \| "fuchsia" ...` | Set color scheme variables. |
| `value` | - | `Y` | The value of the segmented control item. |
| `disabled` | `false` | `boolean` | If `true`, the field will be disabled. |
| `indicatorProps` | - | `SegmentedControlIndicatorProps` | Props for the indicator component. |
| `inputProps` | - | `HTMLProps<"input">` | Props for the input element. |
| `readOnly` | `false` | `boolean` | If `true`, the field will be readonly. |
## Accessibility
When using only icons in `SegmentedControl.Item`, set `aria-label` for the `SegmentedControl.Item`.
```tsx
```
### Keyboard Navigation
| Key | Description | State |
| ------------ | ---------------------------------------------------------------------------------------------------------------------- | ----- |
| `Tab` | Focuses the selected item. | - |
| `ArrowLeft` | Focuses the previous item that is not disabled. If it's the first item, it focuses the last item that is not disabled. | - |
| `ArrowRight` | Focuses the next item that is not disabled. If it's the last item, it focuses the first item that is not disabled. | - |
| `ArrowUp` | Focuses the previous item that is not disabled. If it's the first item, it focuses the last item that is not disabled. | - |
| `ArrowDown` | Focuses 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
| Component | Roles and Attributes | Description |
| ----------------------- | -------------------- | ------------------------------------------------------------------------------------------------ |
| `SegmentedControl.Root` | `role="radiogroup"` | Indicates that it is a radio group. |
| | `aria-disabled` | Sets to `"true"` if `disabled` is set. |
| | `aria-orientation` | Sets `"horizontal"` or `"vertical"` based on the `orientation` value. Default is `"horizontal"`. |
| `SegmentedControl.Item` | `aria-disabled` | Sets to `"true"` if `disabled` is set. |
| | `aria-readonly` | Sets to `"true"` if `readOnly` is set. |