# FormField

A label, a control and the one message under it, wired together.

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

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

<FormField id="period" label="Periode" helper="Vælg hele uger.">
  <input id="period" name="period" type="week" />
</FormField>
```

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| id (required) | `string` |  | The id of the control inside. Give the control the same id. |
| label (required) | `string` |  | The visible label. |
| helper | `string` |  | Guidance shown under the field when there is no error. |
| error | `string` |  | What to do about a problem. Replaces the helper. |
| required | `boolean` |  | Required fields carry no mark. The optional ones are marked. |
| optionalLabel | `string` | `'(valgfrit)'` | The mark on an optional field. |

Do:
- Use it for a control this set does not cover, such as a date or a file.
- Point the control at the message yourself: aria-describedby="{id}-helper" or "{id}-error".

Do not:
- Do not use it around Input, Textarea or Select. They bring their own.
- Do not mark the required fields with an asterisk. The optional ones carry the mark.

Accessibility:
- The label is tied to the control by id.
- The error has the id "{id}-error" and the helper "{id}-helper".

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

---

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.
