# Selected

Selected always means primary: small things fill with it, cards take it as a border and lists mark it with a tick.

This is the rule in `dex.css` terms, 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/selected shows the rule on the Dex app's own React components, which only work inside the Dex codebase.

## HTML

**Fill**, for small things: checkboxes, radios, switches, chips and calendar days. The background and edge go `--dex-primary` and the mark or label goes `--dex-primary-foreground`.

```html
<label class="dex-check-row"><input type="checkbox" class="dex-checkbox" checked /> Open to remote roles</label>
<label class="dex-check-row"><input type="radio" name="level" class="dex-radio" checked /> Senior</label>
<label class="dex-check-row"><input type="checkbox" role="switch" class="dex-switch" checked /> Visible to companies</label>
<button class="dex-chip" aria-pressed="true">Backend</button>
<button class="dex-calendar-day" aria-pressed="true">18</button>
```

**Border**, for things with a description: choice cards keep their card surface so the description stays readable. The edge goes primary and the radio inside fills.

```html
<label class="dex-choice">
  <span>
    <span class="dex-choice-title">Open to the right role</span>
    <span class="dex-choice-detail">A few strong matches, when they come up</span>
  </span>
  <input type="radio" name="search" class="dex-radio" checked />
</label>
```

**Tick**, for lists: the chosen item in a menu or listbox gets a tick at its end.

```html
<div class="dex-menu" role="listbox" aria-label="Notice period">
  <div class="dex-menu-item" role="option">2 weeks</div>
  <div class="dex-menu-item" role="option" aria-selected="true">1 month</div>
  <div class="dex-menu-item" role="option">3 months</div>
</div>
```

**Raised**, the one exception: a segmented control switches a view rather than answering a question, so its active item lifts off a muted track.

```html
<div class="dex-segmented" role="group" aria-label="View">
  <button aria-pressed="true">Matches</button><button>Saved</button>
</div>
```

## States

- A selected item doesn't change on hover.
- On focus a filled control draws a 1px `--dex-primary-foreground` line just inside its edge, and a selected card doubles its edge.
- Disabled, a selected control keeps its primary fill at 50%, so it still reads as chosen.

## Rules

- Selected is never orange. Orange (`--dex-brand`) is for the mark and the one main action.
- The `--dex-accent` fill in a menu follows the pointer or the keyboard. It never marks the chosen item; the tick does.
- In a calendar, today takes a 50% edge (`aria-current="date"`), which is not a selection.
- A multiple-choice chip keeps a leading slot so it never changes width: a plus at rest, a tick when chosen. `dex.css` doesn't draw those icons; see https://brand.meetdex.ai/components/chips.md.
- The shell's tabs (`dex-tab` with `aria-current="page"`) mark the current page with a peach tint, because they sit on the peach shell. Nothing else uses it.
