Skip to content

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

PropTypeDefaultWhat it does
name (required)stringThe form field name.
label (required)ReactNodeWritten as a sentence the reader agrees to, not as a field name.
helperstringGuidance under the checkbox.
errorstringWhat to do about a problem.
requiredbooleanThe box must be ticked before the form posts.
...inputInputHTMLAttributesEverything 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