Skip to main content

What are you looking for?

Try searching for…

Components

Field

Field is a helper component to automatically associate a field with label, description, validation message and character count.

Use field when

  • you need to ensure that label, description, validation message and character count are correctly associated with a field

Avoid field when

  • you need to semantically group multiple fields; use fieldset instead

Example

Prefix/Suffix

Prefixes and suffixes are useful for showing units, currency or other types of information relevant to the field. You should not use these on their own, as screen readers do not announce them. It is important that the same information shown in the prefix or suffix is also included in the label.

Character count

Show users how many characters they have left to type.

Placement

When you use field together with choice components such as switch, you can place the label either before or after the control. This makes it easy to adapt the component to the context.

Guidelines

Field helps you structure form fields in an accessible and consistent way. It automatically links label, description, validation message and character count to the relevant field, so that assistive technology like screen readers reads them as one unit.

Edit this page on github.com (opens in a new tab)