Text field

Figma logo The guideline content on this page is synced with Figma and can be used as a source of truth. Open in Figma

Users enter and edit text or numbers in a form using an text input field.


Anatomy

  1. Label
  2. Mandatory (optional)
  3. Container
  4. Helper text
  5. Help label
  6. Info icon (optional)
Input field anatomy diagram showing the 6 component parts

States

  1. Enabled
  2. Hover
  3. Selected
  4. Focused
  5. Error
  6. Error focused
  7. Read only
  8. Disabled
Change this to a short description.
Change this to a short description.
Change this to a short description.
Change this to a short description.
Change this to a short description.
Change this to a short description.
Change this to a short description.
Change this to a short description.

Label

A label is mandatory for all text fields and should describe the field's purpose. Labels are included by default. If another element (such as a section title) already serves as a clear description, the default label can be visually hidden.

Change this to a short description.

Required/optional fields

We use an asterisk to indicate a field is required.

The convention of using a red asterisk (*) in a label to denote a required field is a long-standing and widely adopted practice in User Experience (UX) and form design.


Helper text

Helper text communicates requirements and disclaimers below the field. An error message will always replace the helper text when a field validation error is triggered.

Enter a valid email address (e.g., [email protected]).

Numeric

The numeric indicators (like character counts or currency values) can have an optional currency indicator.

SEK
Change this to a short description.

Accessibility

Keyboard interaction

All input fields should be reachable via Tab and Shift+Tab keys.

Change this to a short description.

Specs

Input field specifications with spacing and radius annotations

Developer reference

The following sections describe supported functionality that is not part of the Figma design specification.

Demo enabled on this page! The enhanced keyboard-focus behaviour is active on this page — the .keyboard-focus class is added to each .form-group while a control is keyboard-focused, and removed on blur, click or typing. Try pressing Tab to navigate through the form fields. Read more in the Forms accessibility guidelines.


Basic design

Default

A basic input field with a label. Apply the .form-control class to the <input> element. Supports all HTML5 text-like input types: text, password, email, number, tel, url, search, date, time, color and related variants.

Change this to a short description.

Info icon

Wrap the <label> and an info icon in .label-with-info to place the icon beside the label with the 8 px gap from the Figma anatomy. On hover or keyboard focus, the tooltip opens upwards (data-bs-placement="top") to reveal the supporting text.

Keep the icon outside the <label for> so clicking the icon does not focus the input, and mirror the tooltip text into a visually-hidden element that the input references via aria-describedby — that way assistive tech users hear the same help text without depending on the tooltip.

Tooltip behaviour relies on Bootstrap's tooltip plugin (with Popper for positioning). See the Tooltips page for setup details.

Change this to a short description Provide a clear, concise description so users understand what to enter.

Numeric currency implementation

Wrap the input and a static suffix in .input-group and apply the .input-group-text class to a <span> for the static, non-interactive content. The addon shares its border edge with the input so the two read as a single visual control.

Use a meaningful aria-label on the suffix (e.g. aria-label="Currency: SEK") and reference the suffix from the input's aria-describedby so screen-reader users understand the value's unit before they type.

SEK
Change this to a short description.

Disabled state

Add the disabled attribute on an input to prevent user interaction and trigger the disabled visual treatment. The attribute can also be applied to a parent <fieldset> to disable every form control inside it at once.

Change this to a short description.

Error message implementation

Add the .has-error class to the parent .form-group to show the error treatment. Replace the .help-block content with the alert icon plus the error message; the colour switches to --text-error automatically.

Change this to a short description.

Read-only state

Add the readonly attribute on an input to prevent editing while still allowing the value to be selected and copied. The field uses the muted background and border to indicate the value is not editable.

Change this to a short description.

Accessibility implementation

Always associate a <label> with the <input> using matching for and id attributes. When the input has an associated helper or error message, link it via aria-describedby so assistive technology can announce the additional context.

Enter a valid email address (e.g., [email protected]).

Size variants

The Figma design only documents the standard 32 px input. Two additional size variants are supported in code for backwards compatibility:

  • .input-lg — 48 px tall, used for large hero forms
  • .input-sm — 24 px tall, used for compact layouts and toolbars

New designs should default to the standard 32 px size unless there is a specific reason to deviate.


Deprecated: .inverted on disabled inputs