nteract elements

Textarea

A multiline text input for longer content

A multiline text input with consistent styling and focus states. Ideal for code cells, markdown input, and form fields that require longer text.

Installation

npx shadcn@latest add https://nteract-elements.vercel.app/r/textarea.json

Usage

import { Textarea } from "@/registry/primitives/textarea"

export function Example() {
  return <Textarea placeholder="Type your message here..." />
}

Examples

Default

<Textarea placeholder="Enter some text..." />

With Label

<Label htmlFor="markdown">Markdown Content</Label>
<Textarea id="markdown" placeholder="# Hello World" />

Code Input

<Label htmlFor="code-cell">Cell Source</Label>
<Textarea
  id="code-cell"
  className="font-mono"
  placeholder="import pandas as pd

df = pd.read_csv('data.csv')"
/>

Disabled

<Textarea placeholder="This textarea is disabled" disabled />

With Default Value

<Textarea defaultValue="print('Hello, Jupyter!')" />

Invalid State

<Textarea aria-invalid="true" defaultValue="SyntaxError: invalid syntax" />

Custom Rows

<Textarea rows={10} placeholder="Larger text area..." />

Props

PropTypeDefaultDescription
placeholderstringPlaceholder text
disabledbooleanfalseDisable the textarea
rowsnumberNumber of visible text lines
classNamestringAdditional CSS classes
...propsTextareaHTMLAttributesAll standard textarea attributes

Accessibility

  • Supports aria-invalid for validation states
  • Use with <Label> for proper accessibility
  • Has proper focus-visible styles for keyboard navigation

On this page