TextArea

A multi-line text field, with the look and states of Input.

Usage

TextArea is the box, TextArea.Text the native textarea.

tsx
const [value, setValue] = useState("");

<Label htmlFor="message">message</Label>
<TextArea>
  <TextArea.Text
    id="message"
    value={value}
    onChange={(event) => setValue(event.target.value)}
    placeholder="write something"
  />
</TextArea>

Height

The box is as tall as the rows. Give the box a height and the text fills it.

tsx
<TextArea>
  <TextArea.Text rows={2} placeholder="two rows" />
</TextArea>

<TextArea className="h-40">
  <TextArea.Text placeholder="a fixed box" />
</TextArea>

States

tsx
<TextArea active>
  <TextArea.Text placeholder="active" />
</TextArea>

<TextArea clickable={false}>
  <TextArea.Text placeholder="inert" />
</TextArea>

<TextArea>
  <TextArea.Text placeholder="disabled" disabled />
</TextArea>

In a form

tsx
<form onSubmit={handleSubmit}>
  <TextArea>
    <TextArea.Text name="message" required minLength={20} />
  </TextArea>
  <Button as="button" type="submit">
    <Button.Label>send</Button.Label>
  </Button>
</form>

Reference

proptypedefault
as?ElementType"div"the element or component to render
active?booleanfalsekeeps the border highlighted; visual only
clickable?booleantruefalse makes the whole field inert
…restprops of as—typed against the chosen element

TextArea.Text

proptypedefault
rows?number4the visible lines
className?string—merged over the defaults
…restprops of textarea—value, onChange, name, placeholder, disabled…