Skip to content

Forms overview Visual tests ​

Flip a state and every form control updates at once — a quick way to check that labels, hints, errors, required indicators, disabled and invalid styling stay consistent across the whole form system.

slot end

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

cm

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

Unchecked, for comparison.

This is a hint to help the user.

This is an error message.

Notification preference

This is a hint to help the user.

This is a hint to help the user.

This is an error message.

Overall rating

This is a hint to help the user.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

This is a hint to help the user.

This is an error message.

Focus ​

A focused text field takes the --l-focus-ring color on its border, plus a soft halo. Reshape it with two tokens: --l-form-control-focus-border-width for the stroke, drawn inward so the field never changes size, and --l-form-control-focus-halo-width for the halo. A crisp 2px stroke with no halo — tab through the fields:

css
:root {
  --l-form-control-focus-border-width: 2px;
  --l-form-control-focus-halo-width: 0;
}
Code
html
<div
  class="grid max-w-sm gap-4 [--l-form-control-focus-border-width:2px] [--l-form-control-focus-halo-width:0px]"
>
  <l-form-field>
    <label>Start date</label>
    <input type="date" />
  </l-form-field>
  <l-form-field>
    <label>Plan</label>
    <select class="l-select">
      <option>Starter</option>
      <option>Pro</option>
    </select>
  </l-form-field>
  <l-select
    label="Team"
    placeholder="Pick a team…"
  >
    <datalist>
      <option value="design">Design</option>
      <option value="dev">Development</option>
    </datalist>
  </l-select>
  <l-combobox
    label="Country"
    placeholder="Search a country…"
  >
    <datalist>
      <option value="fr">France</option>
      <option value="de">Germany</option>
    </datalist>
  </l-combobox>
</div>

Checkboxes, radios, switches and buttons draw a ring around themselves instead, sized by --l-focus-ring-width. For one focus thickness everywhere, point the text-field stroke at it:

css
:root {
  --l-focus-ring-width: 2px;
  --l-form-control-focus-border-width: var(--l-focus-ring-width);
  --l-form-control-focus-halo-width: 0;
}