Input

A text field with prefix and suffix addons and validation states.

Label and value

A label sits above, tied to the field by its id. bind:value keeps a state in step with the field.

Validation

required and type are the browser's: submit it empty, or with an invalid email, and the browser stops it. invalid marks the field for any other error, the server's included; the message under it is linked by aria-describedby.

Disabled and readonly

A disabled field is out of the form; a readonly one is submitted and can be selected, not changed.

Prefix and suffix

The prefix snippet sits inside the field, before the text; the suffix snippet sits after it and can hold a control. Both at once frame a value with its units.

Examples

A labelled field
A bound field
Current value: (empty)
Browser validation

Submit it empty, or with a bad email.

An invalid field
Username is already taken.
Disabled and readonly
A prefix icon
A show and hide toggle in the suffix
An amount between a prefix and a suffix
$ USD
A server error on a newsletter form
We'll never share your email.

Try foo@blocked.dev to see the error.