# Choice cards

Options that each need a sentence of explanation, with a radio or checkbox on the right.

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

## HTML

Each card is a `<label>`, so the whole card is the click target, with a radio (or a checkbox for multiple choice) on its right.

```html
<fieldset class="dex-form-row" style="border: 0; margin: 0; padding: 0">
  <legend class="dex-field-label">How actively are you looking?</legend>
  <div style="display: grid; gap: 0.75rem">
    <label class="dex-choice">
      <span>
        <span class="dex-choice-title">Actively looking</span>
        <span class="dex-choice-detail">Dex sends roles as soon as they match</span>
      </span>
      <input type="radio" name="looking" class="dex-radio" checked />
    </label>
    <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 a month</span>
      </span>
      <input type="radio" name="looking" class="dex-radio" />
    </label>
  </div>
</fieldset>
```

- **Multiple choice**: a `dex-checkbox` in place of the radio.
- **In a row**: 2 to 4 cards side by side with `dex-cols` (set `--dex-cols`); they stack on a phone.
- **Invalid**: `aria-invalid="true"` on every card's input turns every border red, with one `dex-field-error` 8px below the group: "Choose one option."
- **Disabled**: `disabled` on a card's input fades the card to 50% on a muted fill; a chosen one keeps its primary border and filled control. A disabled group is a `<fieldset disabled>`, which disables, and so dims, every card in it.

## States

- The card's edge steps 25%, 50% on hover, 75% when its input has keyboard focus. Focus marks the card, not the control inside it.
- Selected: a primary border and a filled control. The surface stays card, so the description stays readable. Never orange.

## Rules

- Use choice cards for options that need a sentence of explanation. Short answers with no description are chips (`dex-chip`).
- Titles say the answer in a few words; the detail is one sentence, no full stop needed.
