Backpack UI
Components
Forms
Text

Text & Textarea

Text

The <FormInputTag /> component can be used on the following text-style input types.


_10
<input type="email">
_10
<input type="number">
_10
<input type="password" />
_10
<input type="search" />
_10
<input type="tel" />
_10
<input type="text" />
_10
<input type="url" />

We have done our best to normalise the behaviour of these types cross-browser, but support remains patchy for some types. Where an input type isn't supported, browsers revert to the 'text' type.

Form inputs should be wrapped in a <FormField /> container. This gives us more freedom when it comes to adding icons to inputs. We provide the <FormInput /> component to handle wrapper and input.



React
Vanilla

_10
<FormInput type="email" placeholder="type: email" />
_10
<FormInput type="number" placeholder="type: number" />
_10
<FormInput type="password" placeholder="type: password" />
_10
<FormInput type="search" placeholder="type: search" />
_10
<FormInput type="tel" placeholder="type: tel" />
_10
<FormInput type="url" placeholder="type: url" />

States

The text input supports the following modifiers. Note that the valid and invalid classnames are added to the input wrapper rather than the input itself.

Inputs can have a loading state too. In this case you should also add tabindex="-1" and/or the disabled attribute to ensure the input cannot receive focus.


React
Vanilla

_10
<FormInput type="text" placeholder="untouched" />
_10
<FormInput disabled placeholder="disabled"/>
_10
<FormInput valid placeholder="valid" />
_10
<FormInput valid={false} placeholder="invalid" />
_10
<FormInput loading disabled placeholder="loading" />
_10
<FormInput floatingLabel={'Floating label'} placeholder="Floating label" />

Textarea

The FormTextarea is a simple wrapper around the native textarea input.


React
Vanilla

_10
<FormTextarea placeholder="untouched" />

States


React
Vanilla

_10
<FormTextarea placeholder="untouched" />
_10
<FormTextarea readOnly value="readonly" />
_10
<FormTextarea disabled value="disabled" />
_10
<FormTextarea valid value="valid" />
_10
<FormTextarea valid={false} value="invalid" />