Grapes homepage1.57.0
  • Guide
  • Tokens
  • Components
    Grapes on GithubGrapes on Figma
    Interaction
    • Button
    • IconButton
    • FloatingActionBar
    • Link
    Icons
    • Icon
    • HighlightIcon
    Form
    • AmountInput
    • Autocomplete
    • AutocompleteMultiple
    • AutocompletePlace
    • CheckboxBox
    • CheckboxField
    • DatePicker
    • FormField
    • Input
    • OptionGroup
    • PasswordInput
    • PhoneInput
    • RadioBox
    • RadioField
    • RadioGroup
    • Select
    • SwitchField
    • TextArea
    • TextInput
    • Upload
    • UploadButton
    Feedback
    • Badge
    • Banner
    • Callout
    • EmptyState
    • Modal
    • ModalSlideshow
    • DeprecatedModalSlideshow
    • PageModal
    • Skeleton
    • Tag
    • Toast
    • Tooltip
    Data display
    • Accordion
    • Avatar
    • Box
    • Calendar
    • CalendarRange
    • CollapsibleList
    • FileCard
    • InfoTip
    • ListBox
    • ListView
    • Panel
    • SidePanel
    • DeprecatedPreview
    • Table
    • Timeline
    • useDateFormatter
    Navigation
    • DropdownItem
    • DropdownMenu
    • Navigation
    • NavigationItem
    • Popover
    • Tabs

    TextArea

    The TextArea component lets users enter long form text which spans over multiple lines.

    View source code
    • Usage
    • Props
    • Accessibility

    Basic usage

    const Demo = () => {
      const [value, setValue] = useState("");
    
      return (
        <TextArea
          placeholder="Describe your expense"
          value={value}
          onChange={(event) => {
            setValue(event.target.value);
          }}
        />
      );
    };
    

    Size

    The rows prop allows you to specify how many rows the textarea should have. Its default value is 3.

    <TextArea rows={10} />
    
    Autosize TextArea

    For browsers compatible with the field-sizing property, the height of the TextArea is determined by its content rather than the specified number of rows. It means that the prop rows has no impact. The TextArea's minimum height is set to 3 rows while the maximum height is set to 400px. Should the content exceed 3 rows, the TextArea will dynamically adjust its height based on the content.