Skip to content
Fleetline

Text field

Usage

Use a text field for short, single-line answers: plate numbers, names, odometer readings, part numbers. Use a textarea for notes longer than a sentence, a select or radios when the answer comes from a short known list, and a combobox when the list is long.

Anatomy

  1. Container — input.input, or div.input.input--affixed when it has affixes; 1px --input-border, 8px radius
  2. Value / placeholder text
  3. Prefix (optional) — .input__affix before .input__control: currency, icon
  4. Suffix (optional) — .input__affix after the control: unit

Examples

Hover and focus-visible are frozen with .is-hover and .is-focus-visible, which share their rules with the real pseudo-classes.

Text field

Vehicles can't change depot while a work order is open.

Error: Enter an email address like name@depot.com.

€
km
<input class="input" id="plate" name="plate" type="text" placeholder="e.g. KX-219">
<input class="input input--sm" …>   <input class="input input--lg" …>   <!-- heights match .btn--sm / .btn--lg -->

<!-- States are attributes -->
<input class="input" … disabled>
<input class="input" … readonly>
<input class="input" … aria-invalid="true" aria-describedby="email-error">

<!-- Prefix / suffix: the border moves to the wrapper; reference the affix so it is announced -->
<div class="input input--affixed">
  <span class="input__affix" id="cost-prefix">€</span>
  <input class="input__control" id="cost" inputmode="decimal" aria-describedby="cost-prefix">
</div>
<div class="input input--affixed">
  <input class="input__control" id="odometer" inputmode="numeric" aria-describedby="odometer-unit">
  <span class="input__affix" id="odometer-unit">km</span>
</div>

API

HookValuesPurpose
.inputblock classBordered text input (on input, or on the wrapper when affixed)
.input--sm | --lgmodifier class32 / 40 (default) / 48px — same as buttons
.input--affixed, .input__control, .input__affixmodifier / partsPrefix and suffix inside the border
disabled / readonlyattributeNot editable (disabled also not focusable or submitted)
aria-invalid="true", :user-invalidattribute / pseudo-classInvalid styling; pair with a .field__error
type, inputmode, autocompleteattributeKeyboard and autofill (email, tel, postal-code…)
.is-hover | .is-focus-visibledocs-only classFreezes a state

Do and don't

Do use the matching type and autocomplete so the right keyboard and autofill appear.
Don't disable a field just to display a value people need to read or copy — use readonly.

Accessibility

Keyboard interaction
KeyBehavior
TabFocuses the field (read-only fields are focusable, disabled ones are skipped)
Typing, ← →, Home EndNative text editing

Tokens

Custom propertyPurpose
--input-border, --input-bg, --input-radiusComponent tokens
--size-control-sm | -md | -lgHeights
--color-text-mutedHover border, affix text
--color-border-focus, --focus-ring-*Focus
--color-border-invalidInvalid border
--color-bg-subtle, --color-border-defaultRead-only
--color-bg-muted, --color-border-subtle, --color-text-disabledDisabled
--color-text-subtlePlaceholder