Skip to content
HomeCobalt

Textarea

Takes text that runs past one line, such as notes or an agenda, and grows with it.

Examples

A labelled box that starts two lines tall and grows with what is written in it.
A long agendaPast 15 lines the box stops growing and scrolls inside itself, so its label stays on screen while you write.
In a fieldThe limit is written in the description, with what is left as you type.

Up to 500 characters, 433 left.

States

This booking has no meals. Add breakfast to tell the kitchen.

DisabledDisabled through the Field, with the reason under it.
Say why the dates changed, so the host can plan the rooms.
InvalidA red wash once the box is left empty, with the error linked to it by the Field.

Usage

Use it when

  • The user writes more than one line: notes, an agenda, a message, a description.
  • The text has line breaks that matter, such as one item per line.

Use something else when

  • The value is one line: a name, an address, a URL, an amount. Use Input instead; Enter in a textarea adds a line and never submits.
  • The value is one of up to 10 known options. Use Select instead.
  • The box needs a name, a description or an error. Use Field instead, which holds the Textarea and wires them to it.

Rules

General

Content

Avoid

Limits

Install

npx shadcn@latest add https://kaanarici.com/r/cobalt/textarea.json
import { Textarea } from "@/components/cobalt/ui/textarea"