Textarea
Multi-line field that grows with its content and counts characters.
Goes straight to the team. We read every one.
Installation
npx shadcn@latest add https://neonkit.heyaadi.com/r/textarea.jsonUsage
import { Textarea } from "@/components/ui/textarea"
<Textarea label="Feedback" maxLength={280} showCount />Examples
Auto-resize
The field grows with its content between minRows and maxRows, then scrolls.
Character limit
With maxLength, the count turns amber in the last 10% and red at the limit.
Error and disabled
API reference
Also accepts every native textarea attribute, and the ref points at the <textarea>. className and style go to the field box around it.
| Prop | Type | Default |
|---|---|---|
label | ReactNodeVisible label, linked to the textarea. | None |
description | ReactNodeHelper text under the field. | None |
error | ReactNodeRed invalid state and message. Replaces description. Pass true for the state without a message. | None |
autoResize | booleanGrow with the content. When off, rows applies and the field resizes by hand. | true |
minRows | numberStarting height in lines. | 3 |
maxRows | numberHeight in lines before the field scrolls. | 10 |
showCount | booleanCharacter count in the corner, as count / maxLength when maxLength is set. | false |
color | NeonColorPalette name or hex. Falls back to --neon-accent, then cyan. | inherited |
size | "sm"Padding, text size and line height. | "md" |
className | stringClasses for the field box: border, background, radius. | None |
containerClassName | stringClasses for the outer block with the label and message. | None |
Accessibility
- required shows the neon dot after the label. A form reset re-counts and re-sizes the field.
- When the browser rejects the field on submit (required, type, pattern), it turns red until it's edited or the form resets. The browser shows its own message.
- The count is linked with aria-describedby, so screen readers read it when the field gets focus.
- maxLength is the native attribute, so typing and pasting stop at the limit.
- Auto-resize re-measures when the value changes and when the field's width changes.