GitHub

input

The label and error are wired up automatically — for/id and aria-describedby are set from name. You don't need to manage ids yourself.

Results update as you type

input({ name: 'email',  label: 'Email address', type: 'email', placeholder: 'you@example.com' })
input({ name: 'email',  label: 'Email address', error: 'Enter a valid email address', value: state.email })
input({ name: 'search', label: 'Search', placeholder: 'Filter by name…', hint: 'Results update as you type' })
PropTypeDefault
namestringAlso used as id base: field-{name}
labelstring
typestringtextAny valid HTML input type
placeholderstring
valuestringPre-filled value — escaped automatically
errorstringTriggers aria-invalid and role="alert"
hintstringHelper text below the input
requiredbooleanfalseAdds required, aria-required, and a visual asterisk
disabledbooleanfalse
idstringOverride the generated id
attrsobject{}Extra attributes on the <input> element