# RadioGroup

One question with a few answers, all shown.

Group: Forms. Code: `components/software/form.tsx`. From the old system: RadioGroup in @id-identity-as/ui/form. Live: https://design.id-hub.dk/software/radio-group

```tsx
import { RadioGroup } from '@/components/software/form';

<RadioGroup
  label="Levering"
  name="delivery"
  required
  defaultValue="standard"
  options={[{ value: 'standard', label: 'Standard, 2 til 4 dage' }, { value: 'express', label: 'Ekspres, næste hverdag' }]}
/>
```

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| label (required) | `string` |  | The question. It is the legend of the group. |
| name (required) | `string` |  | The form field name. One group is one question. |
| options (required) | `SelectOption[]` |  | { value, label, disabled? }. |
| value | `string` |  | The chosen value. With onChange the group is controlled. |
| defaultValue | `string` |  | The value chosen from the start, uncontrolled. |
| onChange | `(value: string) => void` |  | Called with the new value. |
| helper | `string` |  | Guidance under the group. |
| error | `string` |  | What to do about a problem. |
| required | `boolean` |  | Required groups carry no mark. The optional ones are marked. |
| optionalLabel | `string` | `'(valgfrit)'` | The mark on an optional group. |

Do:
- Use it for up to about five answers. More than that is a Select.
- Choose a default only when one answer is right for most.

Do not:
- Do not use it for a product colour or size. That is VariationPicker.
- Do not lay radio buttons out without their fieldset and legend.

Accessibility:
- One fieldset with one legend, so a screen reader says what the options are for.
- Native radio buttons: arrow keys move, a form posts the value.

Tokens it uses:
- color.text.default
- color.text.muted
- type.body.md
- type.body.sm
- type.heading.sm
- space.inline.2
- space.inline.3
- space.inline.5

---

Not drawn in Figma. Kasper decided on 20 November 2026 that internal software gets this set now, built only from the tokens. The look is ours until Peter draws it, and every open choice is a question in docs/SPOERGSMAAL-TIL-PETER.md. The public site, campaigns and brand surfaces use only the components drawn in Figma.

The rules for this set and all 33 components: https://design.id-hub.dk/software.md. Token values: https://design.id-hub.dk/tokens.md.

Index of everything, as text: https://design.id-hub.dk/llms.txt. Never invent a colour, a size, a component or a product fact: if it is not here, it does not exist yet.
