Textarea

A multi-line text field.

Source
$npx @dinachi/cli@latest add textarea

This appears on your public profile.

placeholder
rows
disabled
readOnly

Usage

import { Textarea } from "@/components/ui/textarea"

export function BioField() {
  return (
    <div>
      <label htmlFor="bio">Bio</label>
      <Textarea id="bio" placeholder="A sentence or two about yourself" />
    </div>
  )
}

Examples

This appears on your public profile.

A labelled field with helper text.
import { Textarea } from '@/components/ui/textarea';

export function Example() {
  return (
    <div className="space-y-2 w-full max-w-md">
      <label htmlFor="bio" className="text-sm font-medium text-foreground">Bio</label>
      <Textarea
        id="bio"
        placeholder="A sentence or two about yourself"
        rows={4}
      />
      <p className="text-sm text-muted-foreground">
        This appears on your public profile.
      </p>
    </div>
  );
}

Notes

When to use it

  • Answers of a sentence or more.
  • For a short value, use Input.

API

valuestring
Controlled text.
defaultValuestring
Starting text when uncontrolled.
onValueChange
agent
(value, details) => void
Runs on every edit, for people and agents. details.cancel() refuses an agent's change.
onChange(event) => void
The native change event. Fires for typing and agent edits.
rowsnumber
Visible height in lines. A min-height of 80px still applies.
placeholderstring
Shown while the field is empty.
maxLengthnumber
The most characters it accepts.
readOnly
agent
boolean = false
Selectable but not editable. Refuses agents too.
disabled
agent
boolean = false
Blocks people and agents.

Agent

Inside an AgentProvider, it appears in agent.snapshot() as textarea.

Reads

label

The <label> tied to it, or its aria-label.

value

The current text.

disabled

True when the field is disabled.

Actions

setValue("Final")

Replaces the text.

clear()

Empties the field.

An agent's edit runs through onValueChange first. isAgentChange(details) is true for it; details.cancel() refuses it and tells the agent. A disabled or readOnly textarea refuses on its own.

await agent.act({
  steps: [{ ref: "Bio", action: "setValue", args: ["Designer in Lagos."] }],
})

Accessibility

  • A native <textarea>, with the browser's semantics and editing keys.
  • Name it with <label htmlFor> or aria-label; the agent reads the same name.
  • Point aria-describedby at helper text and character counts.