Skip to content

Internal ID software / Forms

Select

One choice from a list, as the native select.

Not drawn in Figma: built only from the tokens, for internal ID software. In code: components/software/form.tsx. From the old system: Select in @id-identity-as/ui/form.

Example

Vælg et sprog

Vælg et sprog

import { Select } from '@/components/software/form';

<Select
  label="Afdeling"
  name="department"
  autoComplete="off"
  required
  placeholder="Vælg en afdeling"
  options={[{ value: 'salg', label: 'Salg' }, { value: 'lager', label: 'Lager' }]}
/>

Props

PropTypeDefaultWhat it does
label (required)stringThe visible label. Never a placeholder.
name (required)stringThe form field name.
autoComplete (required)AutoCompleteTokenAn HTML autocomplete token such as "email" or "organization", or "off" as the explicit refusal.
helperstringGuidance shown under the field when there is no error.
errorstringWhat to do about a problem. Its presence puts the field in its error state.
requiredbooleanRequired fields carry no mark. The optional ones are marked.
optionalLabelstring'(valgfrit)'The mark on an optional field. Pass a translation here.
options (required)SelectOption[]{ value, label, disabled? }.
placeholderstringThe empty first option, such as "Vælg en afdeling".
...selectSelectHTMLAttributesEverything a native select takes.

Do

  • Give it a placeholder, so nobody has chosen without choosing.
  • Use it from about six options. For fewer, a RadioGroup shows them all.

Do not

  • Do not build a custom list box. The native select works with a keyboard, a phone and a form post.
  • Do not use it for navigation.

Accessibility

  • A native select with a real label.
  • The chevron is decorative and hidden from screen readers.

Tokens it uses

  • color.surface.base
  • color.text.default
  • color.neutral.500
  • color.software.muted
  • radius.sm
  • type.body.md
  • type.body.sm
  • type.heading.sm
  • space.inline.2
  • component.field.padding-top
  • component.field.padding-bottom
  • component.field.padding-x
  • space.inline.3
  • space.section.1