Textarea
Textarea lets the user input plain-text on multiple lines.
#
Importimport { Textarea } from '@volue/wave-react';
#
Examples#
Basic#
ControlledIt is most common to set up Textarea
as a controlled component, meaning that React state drives its value. To achieve this you must provide value
and onChange
properties.
#
With Form FieldTextarea
should be clearly labeled so it's obvious to users what they should enter. Optionally, you may want to connect helper text and/or validation feedback message to the textarea
element.
Thus it is recommended to wrap textareas with Form Field to create a consistent set of form fields that are accessible to screen reader users.
#
PlaceholderPlaceholder text provides examples of the type of data a user should enter.
Placeholder text disappears after the user begins entering data into the textarea and should not contain crucial information. Do not use placeholder text as a replacement for labels or descriptions.
#
Disabled textareaPass isDisabled
prop to the accompanying FormField
and it will cascade down to the textarea.
You can also pass isDisabled
prop directly to Textarea
.
#
SizesWave provides two Textarea
sizes ‐ medium
and small
, with the medium
size used by default. All sizes are aligned with sizes of other related components like Text Input or Select.
#
Size inheritanceTextarea
automatically inherits size, when placed inside a FormField component.
#
ResponsiveTextarea
supports responsive syntax for its size
property, which means you can change its size based on the viewport.
#
Multi-sizingWave provides applySizes
utility, which lets you specify size "scopes" within your app.
All textareas within a scope will share the same size unless overwritten on a per-control basis.
#
Automatic rows adjustmentAutomatic rows adjustment can be accomplished using the autoResize
prop.
#
API ReferenceIn addition to the props below, you can pass all React.TextareaHTMLAttributes
.
Prop | Type | Default |
---|---|---|
css | StitchesCss | No default value |
isDisabled | boolean | No default value |
isReadOnly | boolean | No default value |
isRequired | boolean | No default value |
validationStatus | enum | No default value |
size | enum | No default value |
autoResize | boolean | false |