Textarea
Multi-line fields to get long user inputs.
Textarea
enables users to input multi-line text. It's commonly used for longer user inputs, such as comments or descriptions.Example
Code
Import
Import the component from @faststore/ui
_10import { Textarea } from '@faststore/ui'
Import styles to your FastStore project
To apply the styles of this component in your FastStore project, import the following to your stylesheet:
_10@import '@faststore/ui/src/components/atoms/Textarea/styles.scss';
Follow the instructions in the Importing FastStore UI component styles tutorial.
Props
Name | Type | Description | Default |
---|---|---|---|
testId | string | ID to find this component in testing tools (e.g.: cypress, testing library, and jest). | fs-textarea |
resize | "none" | "vertical" | "horizontal" | "both" | Controls the resize property of the textare (e.g.: none, vertical, horizontal, both). Default is 'both'. | both |
Design Tokens
Local token | Default value/Global token linked |
---|---|
--fs-textarea-padding | var(--fs-spacing-1) var(--fs-spacing-2) |
--fs-textarea-height | calc(var(--fs-control-tap-size) * 3) |
--fs-textarea-bkg-color | var(--fs-color-body-bkg) |
--fs-textarea-box-shadow | none |
--fs-textarea-box-shadow-hover | 0 0 0 var(--fs-border-width) var(--fs-border-color-active) |
--fs-textarea-border-radius | var(--fs-border-radius) |
--fs-textarea-border-width | var(--fs-border-width) |
--fs-textarea-border-color | var(--fs-border-color) |
--fs-textarea-border-color-hover | var(--fs-border-color-active) |
--fs-textarea-text-color | var(--fs-color-text) |
--fs-textarea-text-size | var(--fs-text-size-body) |
--fs-textarea-line-height | 1.25 |
--fs-textarea-transition-function | var(--fs-transition-function) |
--fs-textarea-transition-property | var(--fs-transition-property) |
--fs-textarea-transition-timing | var(--fs-transition-timing) |
Variants
Disabled
_10<Textarea placeholder="Text area disabled" id="textareafield-disabled" disabled />
Local token | Default value/Global token linked |
---|---|
--fs-textarea-disabled-bkg-color | var(--fs-color-disabled-bkg) |
--fs-textarea-disabled-border-width | var(--fs-border-width) |
--fs-textarea-disabled-text-color | var(--fs-color-disabled-text) |
--fs-textarea-disabled-border-color | var(--fs-border-color) |
Customization
For further customization, you can use the following data attributes:
data-fs-textarea
data-fs-textarea-resize
Best practices
✅ Do's
- Provide a Label when using
Textarea
. Descriptive labels help users understand the purpose of a form control.