Skip to content

Input

Plain CSS on an ordinary <input>, so the browser’s own validation, autofill and keyboard handling work as before.

data-stateUsed for
(omitted)Normal state
invalidValidation has failed
successThe value is confirmed valid

data-state is colour. Screen readers also need aria-invalid="true", or Field, which sets both.

Only date, time and datetime-local affect the appearance. The other types exist so that the TypeScript helper can set type for you.

SituationComponent
The browser’s own date picker is enoughInput with type="date"
You need to ask for a dateDates in a form
ClassWhat it is
.lt-inputThe field. The state comes from data-state, the icon from data-variant.
VariableDefault
--lt-input-width100%
--lt-input-paddingvar(--lt-spacing-2) var(--lt-spacing-3)
--lt-input-radiusvar(--lt-spacing-1)

An example. A form to be filled in on a phone can take larger touch targets, and your organisation may want square corners:

The variable is on the container, not on the field, so it applies to every field in the form without you touching any of them.

See Customising for how the variables and the layer work.

  • Every field needs a visible <label> with for. placeholder is no replacement, since it disappears as soon as the user types.
  • Use the right type. It decides the phone keyboard and what autofill the browser offers.
  • Set autocomplete on fields that ask for personal details, for example autocomplete="email".