Internal ID software / Forms
Checkbox
One checkbox: a consent, a preference, a setting.
Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/form.tsx. From the old system: Checkbox in @id-identity-as/ui/form.
Example
Du kan slå det fra igen under Indstillinger.
Du kan slå det fra igen under Indstillinger.
import { Checkbox } from '@/components/software/form';
<Checkbox name="terms" required label="Jeg accepterer, at priserne er ekskl. moms" />Props
| Prop | Type | Default | What it does |
|---|---|---|---|
name (required) | string | The form field name. | |
label (required) | ReactNode | Written as a sentence the reader agrees to, not as a field name. | |
helper | string | Guidance under the checkbox. | |
error | string | What to do about a problem. | |
required | boolean | The box must be ticked before the form posts. | |
...input | InputHTMLAttributes | Everything a native checkbox takes: defaultChecked, onChange, value. |
Do
- Write the label as a full sentence.
- For several options under one question, use a fieldset with a legend around the checkboxes.
Do not
- Do not tick a consent in advance.
- Do not use a checkbox for a choice between two named things. That is a RadioGroup.
Accessibility
- A native checkbox; the label is part of the click target.
- It is ticked in the text colour, never in Flare.
Tokens it uses
- color.text.default
- color.software.muted
- type.body.md
- type.body.sm
- type.heading.sm
- space.inline.1
- space.inline.3
- space.inline.5