---
title: Segmented control
summary: A segmented control is a row of two or more mutually exclusive options styled as one bar, an alternative to radios or tabs.
description: A set of mutually exclusive options displayed as connected buttons.
source: core/scss/ui/_segmented.scss
sass-vars: segmented-nav
classnames:
component:
- class: nav-segmented
desc: Applied together with nav, turns it into a segmented control
direction:
- class: nav-segmented-vertical
desc: Stacks the segments in a column
size:
- class: nav-sm
desc: Small size
- class: nav-lg
desc: Large size
---
import Example from '@components/Example.astro';
import Icon from '@ui/Icon.astro';
A segmented control is a `nav` element with the `nav-segmented` class, holding `button` or `a` elements with the `nav-link` class.
## Full width
Add `w-100` to the `nav` to stretch the control to the width of its container.
```html
```
## With emojis
A segment can hold an emoji.
## With icons
A segment can hold an [icon](/ui/components/icon).
## Vertical direction
To create a vertical segmented control, add the `nav-segmented-vertical` class to the `nav` element.
```html
```
## Sizes
Add `nav-sm` or `nav-lg` to the `nav` to change the size.
```html
```
## Accessibility
- A segmented control that switches panels is a tab list: put `role="tablist"` on the `nav`, `role="tab"` on each button, and link them to the panels with `aria-controls`.
- A segmented control that picks a value is a radio group instead. Use `input type="radio"` with a shared name inside a `fieldset` with a `legend`, so the arrow keys work and the group has a name.
- Do not mix the two. Buttons with `aria-pressed` in a row read as separate toggles, which is not what a segmented control looks like.
- Every segment needs a text label. An emoji or an icon alone leaves the option unnamed - add an `aria-label` if the design has no room for words.