Blueprint

Textarea

A Textarea allows users to enter any combination of letters, numbers, or symbols in a multi-line input box.

Design guidance

When and how to use this

Use a Textarea when the user needs to be able to enter longer, multi-line freeform input in the form of letters, numbers, or symbols. Textareas are ideal for cases where users might be pasting in longer snippets of text from their clipboard.

When to consider something else

For cases where a user needs to enter or paste shorter input, consider using a TextInput instead.


Figma

Drag in a Textarea Field from the Compositions section in the Form Controls v2 library in your Assets pane. We provide default and error states as well as a required attribute for the field. A Textarea component is nested within, where you can set its state (Idle, Focus, Disabled, and so on). You can also drag in a Textarea on its own from the Components section, but we recommend using the Field composition in most cases.

React

Textarea composes Chakra's Textarea. We offer size variants that align with those in TextInput. We recommend wrapping your Textarea in a Field to get a <label> element, error display below the field (if an error is present) which will also trigger isInvalid on the Textarea.

live

<Stack direction="column" spacing="400">
<Textarea placeholder="I'm idle" rows="2" />
<Textarea placeholder="I'm invalid" rows="2" isInvalid />
<Textarea placeholder="I'm disabled" rows="2" isDisabled />
<Field label="I'm a label">
<Textarea placeholder="I'm wrapped in a Field" rows="2" />
</Field>
<Field label="I'm a label" error="I'm an error message">
<Textarea value="I'm wrapped in a Field that has an error" rows="2" />
</Field>
</Stack>


PropDescription
sizeSets the size of the Textarea. Use small or tiny only for especially compact interfaces.
placeholderSets placeholder text for the Textarea.
resizeBy default a Textarea can be resized horizontally and vertically. Use this optional prop to constrain resizing to horizontal or vertical, or set this to none to fix the size.
valueSets a default value for the Textarea.
isDisabledIf true the Textarea will be disabled.
isInvalidIf true the Textarea will be invalid and its aria-invalid will be set to true

Bootstrap

Bootstrap provides styles for Textarea and label elements, using the .form-control and .form-label classes. We match React size variants via .form-control-sm and .form-control-tiny. Using Bootstrap's .form-control-lg maps to our default.

live

<div>
<label for="exampleFormControlTextarea1" class="form-label"
>I'm a label</label
>
<textarea class="form-control" id="exampleFormControlTextarea1" rows="2">
I'm a Bootstrap Textarea</textarea
>
</div>

ClassDescription
.form-control and .form-labelInvokes Bootstrap theme styles for text inputs and labels.
.form-control-sm and form-control-tinyReproduces the small (default 16/24 text) and tiny (14/20 text) size variants found in Figma and React

Copyright © 2024 Hover Inc. All Rights Reserved.