Skip to content

TextInput ​

TextInput is the input of one line of text.

When to use ​

Use it for one line of text, in a Field, which gives it a name, or named with aria-label. unit places a unit inside on the right, mono sets a code or an identifier in the monospace font, and title makes it the input of a name, at the size of h2. suggestions lists values that may be picked or typed over. For several lines use a Textarea, for a number a NumberInput.

Props ​

PropDefaultDescription
value''The text (bindable)
typetexttext, email, password or url
placeholderShown while it is empty
id, name, autocompletePassed to the input
unitA unit on the right inside the control
monofalseThe monospace font, with figures of equal width
titlefalseThe size and weight of h2
suggestionsValues to pick from, or to type over
errorfalseThe line turns red
disabledfalseCannot be focused or changed
readonlyfalseCan be focused and selected, not changed
oninput, onchangeEvery key stroke, and the committed value
onkeydown, onblurPassed to the input

Other attributes (aria-*, inputmode, maxlength) go to the input.

Contract ​

The control is a <label> of the height its container declares, a button's by default, with one line in line-strong and pad-md at the sides; a press anywhere on it focuses the input. The input inside has no line and no ring of its own. Focus turns the control's line blue-ink, an error turns it red-ink, and the placeholder is faint. The unit is muted and trimmed to its ink. The width is the container's. Disabled is dimmed.

Example ​

TextInput

Released under the Apache-2.0 license.