Skip to content

Search

Start typing to search.


Show all pages

Documentation

controls

Field

Wraps a form control with its label, a hint and an error message.

CSS onlyPlain classes; no JavaScript in any stack.

Usage

A field holds a label, a control and optionally a hint. Connect them with for, id and aria-describedby.

As it appears on your driving licence.

HTML

Examples

With an error

Mark the control with aria-invalid="true" and point aria-describedby at the error message.

Enter an email address like name@example.com.

HTML

With a text area

The input classes also style a <textarea>; give it a minimum height.

Optional. Your instructor reads this before the lesson.

HTML

Guidance and accessibility

When to use

  • Use a field around every form control that needs a label, a hint or an error.
  • Put format help in the hint before people type, not only in the error afterwards.
  • Write errors that say how to fix the value: “Enter an email address like name@example.com”, not “Invalid input”.

Accessibility

  • Every control needs a visible <label> connected with for and id. A placeholder is not a label.
  • Connect hints and errors with aria-describedby, so screen readers read them with the label.
  • On submit, set aria-invalid="true" on invalid controls, show the error and move focus to the first invalid control. Keep the submit button enabled.

Classes

Generated from the component contract. Parts use __, modifiers use --.

Classes of the field component
ClassKindUse it for
ca-fieldComponentOne-column stack of label, control, hint and error.
ca-field__labelPartThe visible label of the control.
ca-field__hintPartHelp text that stays visible, such as a format.
ca-field__errorPartError message, shown when the value is invalid.

Skins

The same markup, dressed by each skin. Structure and behavior stay the same; only the look changes.

Base skin

Neutral grayscale starting point; product skins extend it and change what differs.

As it appears on your driving licence.

Calaca skin

The Calaca UI brand: hueso paper and tinta ink, cempasúchil marigold, rosa and jade.

As it appears on your driving licence.

Proof skin

Pilot skin pushed far from base: square, heavy, offset shadows, larger targets.

As it appears on your driving licence.

Crossview skin

The CrossView proofing table: cool ground, bond-paper sheets, rule-grey hairlines, one red mark.

As it appears on your driving licence.

Framework notes

Link the prebuilt stylesheet of your skin next to your brand theme. No build step.

HTML
<link rel="stylesheet" href="theme.css" />
<link rel="stylesheet" href="ca-base.css" />