# Radio

Picks exactly one option from a short list.

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/radio shows the Dex app's own React component, which only works inside the Dex codebase.

## HTML

Radios always come in a group: a `<fieldset>` with the question as its `<legend>`, and each radio in a `dex-check-row` label. Give them one `name`.

```html
<fieldset style="border: 0; margin: 0; padding: 0; display: grid; gap: 0.75rem">
  <legend class="dex-field-label" style="margin-bottom: 0.75rem">What level are you at?</legend>
  <label class="dex-check-row"><input type="radio" name="level" class="dex-radio" /> Mid-level</label>
  <label class="dex-check-row"><input type="radio" name="level" class="dex-radio" checked /> Senior</label>
  <label class="dex-check-row"><input type="radio" name="level" class="dex-radio" /> Staff or principal</label>
</fieldset>
```

- **With descriptions**: each label goes medium with a muted description under it, as on a checkbox (`align-items: flex-start` on the row). When every option needs a sentence, use choice cards instead (`dex-choice`, https://brand.meetdex.ai/components/choice-cards.md).
- **Invalid**: `aria-invalid="true"` on every radio in the group turns each edge red, with one `dex-field-error` under the group: "Choose your level."
- **Disabled**: the `disabled` attribute, or on the `<fieldset>` for the whole group. A selected radio keeps its fill at 50%.

## States

- Rest, hover and focus step the edge from 25% to 50% to 75%. Selected, it fills primary with a dot in the primary foreground.

## Rules

- Use radios for exactly one option from a short list. For several, use checkboxes; for a long list, a select or combobox.
- Pressing a label chooses its radio.
- The label is regular weight unless a description follows it.
- One message for the group, never one per option.
