Skip to content
caliper ui docs

Components

Textarea

A recessed multi-line field that grows with the draft from 3 to 8 lines.

Free
pnpm dlx shadcn@latest add @caliper/textarea

Publish v2.14

Drafted by Mara Chen · goes out with the 14:00 deploy

Plain text. Links become clickable.79 / 280

Installs components/ui/textarea.tsxDepends on none beyond ReactMotion none in component source

When to use

Use it for

  • Notes, descriptions and messages longer than a line.
  • Anywhere a native textarea is right but needs the shared styling.

Skip it when

  • The text is formatted; use the rich text editor.
  • A single line is enough; use an input.

Installation

terminal
pnpm dlx shadcn@latest add @caliper/textarea

Adds its 2 files to components/ui/, each with its own stylesheet, and installs their packages. No account needed. The first part also adds Caliper UI’s tokens; import them once as in Installation.

Usage

This is the code behind the preview above.

example.tsx
import { useState, type ReactNode } from "react"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"

function Panel({ title, context, className = "max-w-md", children }: { title: string; context: string; className?: string; children: ReactNode }) {
  return (
    <section className={`grid w-full gap-5 rounded-overlay border border-border bg-background p-6 shadow-resting ${className}`}>
      <div className="grid gap-1">
        <p className="font-medium">{title}</p>
        <p className="text-sm text-muted-foreground">{context}</p>
      </div>
      {children}
    </section>
  );
}

export function NoteField() {
  const [note, setNote] = useState("Invoices now show tabular figures, and eu-central-1 cold starts are 38% faster.");
  const over = note.length - 280;
  return (
    <Panel title="Publish v2.14" context="Drafted by Mara Chen · goes out with the 14:00 deploy">
      <div className="grid gap-1.5">
        <Label htmlFor="docs-note">Release notes <span className="font-normal text-muted-foreground">Shown in the changelog</span></Label>
        <Textarea id="docs-note" value={note} aria-invalid={over > 0 || undefined} aria-describedby="docs-note-msg" placeholder="What changed, in a sentence or two" onChange={(event) => setNote(event.currentTarget.value)} />
        <p id="docs-note-msg" role="status" className={over > 0 ? "flex text-xs text-danger" : "flex text-xs text-muted-foreground"}>
          <span className="flex-1">{over > 0 ? `${over} characters over. Shorten the note to publish.` : "Plain text. Links become clickable."}</span>
          <span className="font-mono text-[11px] tabular-nums">{note.length} / 280</span>
        </p>
      </div>
    </Panel>
  );
}

API reference

Textarea

component

No props of its own; it accepts the native props of its root element.

Accessibility

It is built on native elements, so roles and focus come from the browser.

No custom key handling; Tab and the native activation keys do the work.

Motion

It declares no animation in its component source. Any transition comes from its stylesheet, which uses the duration tokens that collapse to instant under prefers-reduced-motion.

All Assistant examples