# Segmented control

Switches between a few views or values of one setting.

This is the HTML to build it with `dex.css`, for work outside the Dex codebase. Read https://brand.meetdex.ai/design.md first: it says how to set up a page and how to use the stylesheet. The page at https://brand.meetdex.ai/components/segmented-control shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

```html
<div class="dex-segmented" role="group" aria-label="Theme">
  <button aria-pressed="false">System</button>
  <button aria-pressed="true">Light</button>
  <button aria-pressed="false">Dark</button>
</div>
```

- **Full width**: `style="width: 100%"` on the control and `style="flex: 1"` on each button.
- **Disabled**: `disabled` on a button fades it to 50% and stops its hover. To disable the whole control, put `disabled` on every button.

## States

- The active item is a raised card pill on a muted track, not a primary fill. Mark it with `aria-pressed="true"`.
- Focus is the 75% edge inside the item.

## Rules

- Use it to switch a view or a setting, not to answer a question. For answers, use chips or radios.
- One item is always on. Pressing the active item again doesn't clear it.
- When each option has its own panel of content, use tabs (https://brand.meetdex.ai/components/tabs.md); their pill variant shares this look.
- Give the control an `aria-label` that names what it switches.
