TextArea

TextArea represents a multi-line plain-text editing control.

Useful when you want to allow users to enter a sizeable amount of free-form text, for example a comment on a review or feedback form.

Simple TextArea

This is an informative helper text.

Controlled TextArea

You can use the value, and onChange properties to control the behaviour of the textarea.

The value is
""

API

Learn more about the properties and the customization points.

Usage

import TextArea from "@sonnat/ui/TextArea";
//or
import { TextArea } from "@sonnat/ui";

Properties

Note that the documentation avoids mentioning all the native props (there are a lot) in this section of the components.

TextArea Properties
NameTypeDefaultDescription
classNamestring-Append to the class names applied to the component so you can override or extend the styles.
minRowsstring | number-Minimum number of rows to display.
maxRowsstring | number-Maximum number of rows to display. (works only when autoResize={true})
namestring-The name of the textarea.
placeholderstring-The placeholder property of the textarea.
valuestring-The value of the textarea. The DOM API casts this to a string.
defaultValuestring-The default value. Use when the component is not controlled.
helperTextstring-The helper text content.
helperIconnode-The helper icon element placed before the helper text.
size"large"
| "medium"
| "small"
"medium"The size of the textarea.
autoResizebooleanfalseIf true, the textarea will automatically adjust the height.
resizablebooleanfalseIf true, the textarea will be vertically resizable.
disabledbooleanfalseIf true, the textarea will be disabled.
readOnlybooleanfalseIf true, the textarea will be readOnly.
focusedbooleanfalseIf true, the textarea will be focused.
autoFocusbooleanfalseIf true, the textarea will be focused on mount.
requiredbooleanfalseIf true, the textarea will be required.
hasErrorbooleanfalseIf true, the textarea will indicate invalid input.
fluidbooleanfalseIf true, the textarea will be fluid (max-width: 100%)
inputPropsobject-The properties applied to the textarea element.
onChangefunction-The callback fires when the state has changed.
Signature: function(value: string) => void
  • The ref is forwarded to the root element.
  • Any other properties supplied will be provided to the root element.