Forms

Field Group

Wraps a control with its label and its message. Both are real elements, so screen readers announce them, browsers translate them, and users can select the text.

On this page
ElementRole
<span>the label
the controlpui-input, a checkbox, anything
<small>the message, help text or error

No class goes on the children: they are matched by their tag. The <label> wrapper is what makes clicking the label focus the control.

Errors

The error state is aria-invalid on the control. There is no error class:

The control's border turns red and the message follows it. Because the state lives on the control, a screen reader announces the field as invalid — a class could never do that.

input.setAttribute("aria-invalid", "true");
input.removeAttribute("aria-invalid");

Any control