---
title: "Segmented Control"
description: "Pick one value from a few options in one row. A pill slides to the choice, and the value goes with the form like a radio group."
url: https://gelatinui.com/components/segmented-control
markdown_url: https://gelatinui.com/components/segmented-control.md
access: free
install: "npx shadcn@latest add @gelatin-ui/segmented-control"
registry_item: https://gelatinui.com/r/segmented-control.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Segmented Control

> Pick one value from a few options in one row. A pill slides to the choice, and the value goes with the form like a radio group.

Page: https://gelatinui.com/components/segmented-control

## When to use it

Best for: Pick one value from a few attached options, with a sliding pill and a form value.

- Use it for a few options that all stay in view.
- Use `name` to send the value with a form.
- Use `fullWidth` to fill the box with equal items, and `orientation` for a column.
- Use `value={null}` to show no pill until people pick.

## When not to use it

- For many options, use a [Select](https://gelatinui.com/components/select.md).
- For one value that stays on or off, use a [Switch](https://gelatinui.com/components/switch.md).
- For views with panels, use Tabs.
- For many values at once, use a Toggle Group.

## Notes for agents

- Name it with `aria-label`, `aria-labelledby`, or a `FieldLabel` above it.
- With a `FieldLabel`, set `nativeLabel={false} render={<div />}`. A legend would sit inside the track.
- An icon-only item needs `className="aspect-square px-0 has-[svg]:px-0"`, an `aria-label`, and a Tooltip.
- With `fullWidth`, put a long label in a `<span>` so it ends in an ellipsis.
- It is a Base UI Radio Group. All its props pass through, with the `Value` generic.
- Sizes are `xs`, `sm`, `default`, and `lg`. `rounded` is `default` or `full`.

## Anatomy

```text
SegmentedControl
└─ SegmentedControlItem (0..n)
```

## API reference

### SegmentedControl

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `fullWidth` | `boolean` | false |  |
| `orientation` | `"horizontal" \| "vertical"` | "horizontal" |  |
| `rounded` | `"default" \| "full"` | "default" |  |
| `size` | `"default" \| "lg" \| "sm" \| "xs"` | "default" |  |
| `className` | `string` |  |  |

Also takes every prop of Base UI `RadioGroup`: https://base-ui.com/react/components/radio-group

### SegmentedControlItem

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `className` | `string` |  |  |

Also takes every prop of Base UI `Radio.Root`: https://base-ui.com/react/components/radio

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| SegmentedControl | `segmented-control` | `data-disabled`, `data-invalid` | `--radius` | `hit-area` |
| SegmentedControlItem | `segmented-control-item` | `data-checked`, `data-disabled`, `data-full-width`, `data-invalid`, `data-orientation`, `data-pressed`, `data-readonly`, `data-rounded`, `data-size` | `--radius` | `hit-area` |

## Usage

Name it with `aria-label` or a `FieldLabel`. Each `SegmentedControlItem` has a `value`.

```tsx title="period-control.tsx"
import { SegmentedControl, SegmentedControlItem } from "@/components/ui/segmented-control";

export function PeriodControl() {
  return (
    <SegmentedControl aria-label="Period" defaultValue="daily">
      <SegmentedControlItem value="daily">Daily</SegmentedControlItem>
      <SegmentedControlItem value="weekly">Weekly</SegmentedControlItem>
      <SegmentedControlItem value="monthly">Monthly</SegmentedControlItem>
    </SegmentedControl>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/segmented-control
```

It adds 10 registry items: 9 files, 1450 lines, and the npm packages `@base-ui/react`, `@mantine/hooks`, `motion`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Select](https://gelatinui.com/components/select.md)
- [Switch](https://gelatinui.com/components/switch.md)
- [Tag Group](https://gelatinui.com/components/tag-group.md)
- [Tabs](https://gelatinui.com/components/tabs.md): Pick Tabs to switch between views that each show their own panel in one shared place.
- [Toggle Group](https://gelatinui.com/components/toggle-group.md): Pick Toggle Group when people can turn on many options at once, or turn all of them off.
- [Radio Group](https://gelatinui.com/components/radio-group.md): Pick Radio Group for a form choice from 2 to 5 options that each need a label or help text.

## Keyboard

| Keys | Action |
| --- | --- |
| Tab | Moves focus to the control. The control is one tab stop. |
| Arrow keys | Moves to the next or previous item and checks it. Right to left swaps them. |
| Space | Checks the focused item. |

## Accessibility

It is a Base UI Radio Group with one tab stop. The arrow keys move the choice.

An icon-only item needs an `aria-label`.

It sends its value with a native form submit when it has a `name`.
