# Choice card

A radio or a check set as a large plate carrying a name, a sentence and a price. The plate is a big key on a skirt with a small check key in its corner; the chosen one goes down below the panel and its corner key latches. Under it is the real radio or checkbox, so a group is a native radio group and posts with the form.

Kit part · Free · https://tactileui.dev/parts/choice-card

- Element: `<label class="tui-choice-card">`
- Needs: `kit.css` only, no script ([how to install the kit](https://tactileui.dev/docs/installation#the-kit))
- Categories: Cards & panels, Checkboxes, Radio groups
- Finishes: Aluminium, Graphite, Oak, Walnut, Porcelain, Black, Daylight, Night, Paper, Phosphor, E-paper, AMOLED
- Volumes: Tactile, Quiet

## Variants

### One of three · radios

```html
<fieldset class="tui-choice-cards" style="width:min(620px,100%)"><legend class="tui-label">Plan</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="pl75" value="solo" tabindex="-1"><span class="tui-choice-card__name">Solo</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">One person, three projects.</span><span class="tui-choice-card__price">£0 <small>free for ever</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="pl75" value="team" checked tabindex="-1"><span class="tui-choice-card__name">Team</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Shared projects for up to ten people.</span><span class="tui-choice-card__price">£12 <small>a seat, monthly</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="pl75" value="scale" tabindex="-1"><span class="tui-choice-card__name">Scale</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Unlimited people and a named contact.</span><span class="tui-choice-card__price">£48 <small>a seat, monthly</small></span></label></div></fieldset>
```

### Any number · checks

```html
<fieldset class="tui-choice-cards" style="width:min(460px,100%)"><legend class="tui-label">Add-ons</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="checkbox" name="v-ad" value="a" checked tabindex="-1"><span class="tui-choice-card__name">Priority support</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">A reply within the hour.</span><span class="tui-choice-card__price">£20 <small>a month</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="checkbox" name="v-ad2" value="b" tabindex="-1"><span class="tui-choice-card__name">Ten more seats</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">For a busier team.</span><span class="tui-choice-card__price">£90 <small>a month</small></span></label></div></fieldset>
```

### A column · --stack

```html
<fieldset class="tui-choice-cards tui-choice-cards--stack" style="width:min(340px,100%)"><legend class="tui-label">Billing</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="v-b" value="m" checked tabindex="-1"><span class="tui-choice-card__name">Monthly</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Cancel whenever you like.</span><span class="tui-choice-card__price">£12 <small>a seat</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="v-b" value="y" tabindex="-1"><span class="tui-choice-card__name">Yearly</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Two months free.</span><span class="tui-choice-card__price">£120 <small>a seat</small></span></label></div></fieldset>
```

### Without a price

```html
<fieldset class="tui-choice-cards" style="width:min(460px,100%)"><legend class="tui-label">Delivery</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="v-d" value="a" checked tabindex="-1"><span class="tui-choice-card__name">Courier</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Next working day.</span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="v-d" value="b" tabindex="-1"><span class="tui-choice-card__name">Collect</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">From the Porto studio.</span></label></div></fieldset>
```

### Disabled

```html
<fieldset class="tui-choice-cards" style="width:min(460px,100%)"><legend class="tui-label">Plan</legend><div class="tui-choice-cards__set"><label class="tui-choice-card" aria-disabled="true"><input class="tui-choice-card__input" type="radio" name="v-x" value="a" disabled tabindex="-1"><span class="tui-choice-card__name">Scale</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Ask your administrator.</span><span class="tui-choice-card__price">£48 <small>a seat</small></span></label><label class="tui-choice-card" aria-disabled="true"><input class="tui-choice-card__input" type="radio" name="v-x" value="b" checked disabled tabindex="-1"><span class="tui-choice-card__name">Team</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Where you are now.</span><span class="tui-choice-card__price">£12 <small>a seat</small></span></label></div></fieldset>
```

## Every state

- Up
- Hover
- Pressing
- Chosen
- Focus
- Disabled

Hover, pressed and focus are forced with `.is-hover`, `.is-down` and `.is-focus`; checked and disabled are real.

## API

| Name | Kind | Values | What it does |
| - | - | - | - |
|  | element | with a legend | The group and its name, around a .tui-choice-cards__set grid that fits as many plates as the width holds. Add --stack to the fieldset for a single column. |
| label.tui-choice-card | element | holds the input and its words | One plate. The label is the plate, so a press anywhere on it is a press on the input. |
| input.tui-choice-card__input | element | radio or checkbox | The real control, laid over the whole plate and invisible. Give radios one name; set checked and disabled on it as on any input. |
| .tui-choice-card__name · __desc · __price | class | in the label | The name, the sentence and the price. Put the unit in a small inside the price: “£12 a seat, monthly”. |
| .tui-choice-card__mark | class | aria-hidden | The small check key in the corner: round for a radio, square with a tick for a check. It is drawn from the input’s state. |
| aria-disabled | attribute | on a disabled plate’s label | Optional beside the input’s disabled; it lets the reader’s tools treat the plate as dimmed on purpose. |
| ← → ↑ ↓ · Space | key | on the input | The browser’s own: arrows move and choose in a radio group, Space chooses a card or turns a check. |

## Markup

```html
<fieldset class="tui-choice-cards">
  <legend class="tui-label">Plan</legend>
  <div class="tui-choice-cards__set">
    <label class="tui-choice-card">
      <input class="tui-choice-card__input" type="radio" name="plan" value="team" checked>
      <span class="tui-choice-card__name">Team</span>
      <span class="tui-choice-card__mark" aria-hidden="true"></span>
      <span class="tui-choice-card__desc">Shared projects for up to ten people.</span>
      <span class="tui-choice-card__price">£12 <small>a seat, monthly</small></span>
    </label>
    <label class="tui-choice-card"> … </label>
  </div>
</fieldset>

<!-- Any number: checkboxes. A column: tui-choice-cards--stack -->
<input class="tui-choice-card__input" type="checkbox" name="addon" value="support">
```

The demo on the page:

```html
<form class="tui-panel" style="width:min(100%,640px);display:grid;gap:16px;text-align:left" action="/parts/choice-card" method="get" data-cc-form><div class="tui-panel__head" style="margin-bottom:0"><span class="tui-label">Upgrade · Northwind</span><span class="tui-status"><span class="tui-lamp" data-on></span>Trial</span></div>
  <fieldset class="tui-choice-cards"><legend class="tui-label">Plan</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="plan" value="solo"><span class="tui-choice-card__name">Solo</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">One person, three projects.</span><span class="tui-choice-card__price">£0 <small>free for ever</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="plan" value="team" checked><span class="tui-choice-card__name">Team</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Shared projects for up to ten people.</span><span class="tui-choice-card__price">£12 <small>a seat, monthly</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="radio" name="plan" value="scale"><span class="tui-choice-card__name">Scale</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">Unlimited people and a named contact.</span><span class="tui-choice-card__price">£48 <small>a seat, monthly</small></span></label></div></fieldset>
  <fieldset class="tui-choice-cards tui-choice-cards--stack"><legend class="tui-label">Add-ons</legend><div class="tui-choice-cards__set"><label class="tui-choice-card"><input class="tui-choice-card__input" type="checkbox" name="addon" value="support"><span class="tui-choice-card__name">Priority support</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">A reply within the hour.</span><span class="tui-choice-card__price">£20 <small>a month</small></span></label><label class="tui-choice-card"><input class="tui-choice-card__input" type="checkbox" name="addon" value="seats"><span class="tui-choice-card__name">Ten more seats</span><span class="tui-choice-card__mark" aria-hidden="true"></span><span class="tui-choice-card__desc">For a busier team.</span><span class="tui-choice-card__price">£90 <small>a month</small></span></label></div></fieldset>
  <div style="display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap"><output class="tui-muted" style="font-size:var(--tui-t-small)" data-cc-out aria-live="polite">Team chosen</output><button class="tui-key tui-key--primary" type="submit">Continue</button></div></form>
```

## Usage notes

Press a plan: its plate goes down and the key in its corner latches. Arrow keys move through the plans as they do through any radio group. The add-ons are checks, so any number may be down. The line under the cards says what the form would post.

## Accessibility

- Each card is a native radio or checkbox inside its label, so the name read out is the label’s whole text, “Team, Shared projects for up to ten people, £12 a seat, monthly, radio button, 2 of 3”, with the group’s legend before it.
- The chosen card is told three ways that are not colour: it sits lower, its corner key is latched with a dot or a tick, and the browser says “checked”. Nothing here lights a hue.
- The focus ring goes round the whole plate when its input has the focus, 2px, offset so the skirt does not hide it, and it is as visible on the pressed card as on the others.
- A group of radios gets the browser’s own arrow keys and one tab stop; a set of checks has a tab stop to each, as any checkboxes do.
- On a phone each plate is at least 64px tall and spans the width of its column, the grid never scrolls sideways and the press needs no hover.

## How it’s built

It is the kit’s key drawn large: the same cap, the same skirt (three pixels, as a large key has) and the same pressed shadow, so the plate goes down below the panel exactly as a key does and follows every finish and both volumes. The corner key is the check key drawn small, driven by the input’s own state with `~` instead of a script. The input is stretched over the plate with zero opacity, which is why a press, a label, a focus and the arrow keys all stay the browser’s.

## Rules

Let people pick a plan, a size or an add-on by pressing a whole plate that says what it is and what it costs, with no script.

The full rules are in `choice-card.rules.md` in the brain, which ships with the Kit.

## Related parts

- [Radio](https://tactileui.dev/parts/radio): One choice from a short list in a form: small round keys in a fieldset, the chosen one pressed with a printed dot.
- [Check](https://tactileui.dev/parts/check): An option in a form: a small square key that presses below the plate when chosen, with a tick printed on it.
- [Key](https://tactileui.dev/parts/key): Every button, and every link that acts like one: a cap on a skirt that drops below the plate when pressed.
- [Segmented control](https://tactileui.dev/parts/segmented): A row of keys in a tray with one pressed down: pick a view, a range or a mode and it applies at once. It is the kit’s selector without the lamps, with sizes, a full-width row and icon segments.
