Input

Example

Variants

Basic

white

With label

white

States

white

Sizes

white

Textarea

white

Addons

white
Mr.
Mr.
.00

Addon sizes

white
Mr.
Mr.
.00

Props

<Input />
PropTypeDefaultDescription
* id
string
Html id attribute.
error
bool | node
Error state. If vaule is string, it's treated as error message.
help
string
Help text.
isActive
bool
Active state.
isDisabled
bool
Disabled state.
isReadonly
bool
Readonly state.
label
string
Label text.
leftAddons
Addons.propTypes.left
multiline
bool
Multiline input
name
string
Html name attribute.
onChange
func
(newValue, e) => {}
Value change callback function.
placeholder
string
Placeholder text
renderError
func
Custom error renderer. Passes props as function parameter.
renderHelp
func
Custom help renderer. Passes props as function parameter.
renderLabel
func
rightAddons
Addons.propTypes.right
size
`"small"` | `"large"`
Size of element.
type
string
"text"
Input html type.
value
string
Input value.

Accessibility

Form inputs might seem pretty straightforward, but take extra care when dealing with labels:

Labels

Every input needs a label

Always make sure there is a textual label associated with an input. While it might be tempting to remove labels for one-input forms such as search, each input needs it's own label that clearly describes what the user should enter.

Sometimes, it might be sufficient to provide for example a search icon in the submit button and a placeholder. Sighted users will probably be able to recognize that they are dealing with a searchform - but screenreader users won't. They need a textual label for the input (can be visually hidden) and a readable submit button.

Tooltips

When using a tooltip to further describe an input, make sure the trigger is outside the <label> element. Otherwise it can't be opened using a touchscreen (touching the label focuses the input element) and keyboard users won't be able to focus it (nesting focus is tricky).

Links in labels have the same downsides as Tooltips. Check the section above.

Addons

When using input addons, you as the author must make sure that addons describe inputs correctly and sufficiently. aria-labelledby and aria-describedby work great accross screen readers and are well documented.

Further reading

Aliases

<Textarea /> === <Input multiline />
Lighter

    v1.0.0