Skip to content

Controls

Inputs, selects and textareas are full width, with a label above and room for helper text below.

Write a plain form. Each control fills the width, and a control inside its label sits right under the label text. Buttons, submit buttons included, keep the width of their text.

Select

A select gets a chevron. Where the browser supports a customizable select, the option list follows the theme too.

Textarea

A textarea grows with its text, from 4 to 16 lines, where the browser supports field-sizing. A rows attribute keeps a fixed height.

Helper text

A small right after a control is its helper text. Link it with aria-describedby.

Letters and numbers only.

Fieldset

A fieldset groups related controls under a legend. disabled on the fieldset turns off and fades every control inside.

Shipping

Side by side

Put controls in a .grid to place them in columns that stack on narrow screens.

Output

output shows a computed value in bold with even digit widths, so it does not shift as it changes.

Total: 36

Disabled and read only

Sizes

Styles

.rounded gives pill corners, .square removes them and .outlined makes the background transparent.

Variables

Buttons and inputs share the --i-control- variables.

VariableDefault
--i-control-padding-blockControls: buttons and inputs0.4rem
--i-control-padding-inline0.875rem
--i-control-disabled-opacity0.5
--i-label-font-weightvar(--i-font-weight)
--i-input-outline-widthInputs: text, select and textareavar(--i-focus-ring-width)
--i-textarea-min-heightGrowth range of a textarea without rows, where field-sizing is supported4lh
--i-textarea-max-height16lh
--i-input-color-textlight-dark(#23262c, #e0e3e7)
--i-input-color-backgroundlight-dark(#fbfcfd, #1c212c)
--i-input-color-border3:1 against the page, as WCAG asks for control boundarieslight-dark(#878fa2, #636c84)
--i-input-color-placeholderlight-dark(var(--i-color-subtle), #8891a4)
--i-input-selected-color-backgroundlight-dark(#dfe3eb, #2a3140)
--i-input-active-color-backgroundlight-dark(var(--i-color-white), #1a1f28)
--i-input-active-color-bordercolor-mix(in oklab, var(--i-color-primary), var(--i-color-ink) 10%)
--i-input-focus-color-outlinecolor-mix(in oklab, var(--i-color-primary), var(--i-color-ink) 40%)
--i-input-button-focus-color-outlinevar(--i-input-focus-color-outline)
--i-input-invalid-color-borderDerived from the danger and success colors, like the state iconsvar(--i-color-danger)
--i-input-invalid-active-color-bordercolor-mix(in oklab, var(--i-color-danger), var(--i-color-ink) 15%)
--i-input-invalid-focus-color-outlinevar(--i-input-invalid-active-color-border)
--i-input-valid-color-bordercolor-mix(in oklab, var(--i-color-success), var(--i-color-ink) 15%)
--i-input-valid-active-color-bordercolor-mix(in oklab, var(--i-color-success), var(--i-color-ink) 30%)
--i-input-valid-focus-color-outlinevar(--i-input-valid-active-color-border)