Components › Forms

Textarea counter

A multiline field that shows the character count and enforces a length limit.

Installation

npx plankui@latest add textarea-counter

Usage

import { TextareaCounter } from "@/components/ui/textarea-counter";

<TextareaCounter aria-label="Release note" value={note} onChange={(event) => setNote(event.currentTarget.value)} maxLength={120} />

API reference

PropTypeDefaultDescription
valuestringControlled value. Leave it out to let the field keep its own state.
defaultValuestring""Starting text when uncontrolled.
onChangeChangeEventHandler<HTMLTextAreaElement>Update the value as the user types.
maxLengthnumberrequiredMaximum length, using the browser’s character counting rules.

View the source on GitHub