Inputs · Textareastable
Textarea
A multi-line field with a visible label, help text, validation and an optional character counter. One size; rows sets the height and it auto-grows by default.
Preview
#previewSwitch label position, validation and state. Show code opens the React and CSS below.
45/280
labelPosition top · rows 3 · maxLength 280 · showCounter
feedback-field.tsx
import { Textarea } from "@blade-ai/weft/components/textarea";
export function FeedbackField({ value, error, onChange, onBlur, onSend }: Props) {
return (
<Textarea
label="Message"
placeholder="Type your message here."
value={value}
onChange={onChange}
onBlur={onBlur} // validate on blur, not per keystroke
rows={3}
maxLength={280}
showCounter
onSubmitShortcut={onSend} // Cmd / Ctrl + Enter
isRequired
validationState={error ? "error" : "none"}
helpText="Tell us what went wrong."
errorText={error}
/>
);
}All states
#all-statesEvery state from the Textarea spec, named. Rows 3 (78px).
Default · empty
Filled
Hover
Focus-visible
45/280
Counter · normal
45/50
Counter · near limit
45/30
Counter · over limit
Loading
Success
Error
Disabled
Read-only
Label left
Props
#propsBooleans are is-prefixed. label is required. Anything marked UNDEFINED is an open decision.
Prop
Type
Default
Description
label *
string
—
Visible label. Placeholder never replaces it.
labelPosition
"top" | "left"
"top"
left = 80px label column beside the textarea.
labelWidth
number (px)
80
Label column width when labelPosition="left". No token.
placeholder
string
—
An example value, never a label.
value · defaultValue
string
—
Controlled or uncontrolled value. Pair value with onChange.
onChange
(value: string) => void
—
Fires with the new value.
onBlur
(event: FocusEvent) => void
—
Validate here, not on every keystroke.
rows
number
3
Initial visible rows; fixed height when isAutoGrow is false. Rows 3 = 78px (rows x 20 + 16 + 2).
minRows · maxRows
number
—
Auto-grow bounds. Defaults: UNDEFINED. minRows falls back to rows; maxRows to unbounded.
isAutoGrow
boolean
true
Grows with content (field-sizing: content), then scrolls past maxRows.
resize
"vertical" | "none"
—
Always none while isAutoGrow. Default when fixed: UNDEFINED (renders none).
validationState
"none" | "error" | "success"
"none"
error sets aria-invalid="true".
helpText
ReactNode
—
Guidance under the textarea.
errorText
ReactNode
—
Shown instead of helpText when validationState="error", prefixed "! ".
successText
ReactNode
—
Shown instead of helpText when validationState="success", prefixed "✓ ".
isRequired
boolean
false
Adds * to the label and aria-required.
isDisabled
boolean
false
Not focusable, not submitted, no resize; opacity 50% on the whole field.
isReadOnly
boolean
false
Focusable, submitted, selectable. Tokens: UNDEFINED; drawn with filled tokens, no caret.
isLoading
boolean
false
Spinner top-right inside the box, aria-busy. Editable while loading: UNDEFINED (stays editable).
maxLength
number
—
Not enforced natively: paste is never blocked, going over shows an error. Counting unit: UNDEFINED (counts UTF-16 length).
showCounter
boolean
false
Shows "count/maxLength" right of the help text. Needs maxLength.
onSubmitShortcut
() => void
—
Cmd / Ctrl + Enter handler. Prop name: UNDEFINED. Plain Enter always inserts a new line.
Usage
#usageShort rules for choosing and writing textareas.
Do
Always show a visible label; use placeholder only as an example value.
Size the textarea to the expected answer with rows; let it auto-grow up to maxRows.
Show a counter when there is a maxLength, and warn before the limit.
Validate on blur or submit, and replace help text with the error.
Keep Enter as a new line; offer Cmd / Ctrl + Enter only for comment-style submit.
Don't
Use placeholder as the label.
Show help text and error text at the same time.
Silently cut off pasted text past the limit; show the over-limit error.
Block paste.
Use Textarea for single-line answers; use Text Input.
Disable resizing without auto-grow.
Build anything marked UNDEFINED until it has a decision.
Accessibility
#accessibilityNative <textarea> behaviour; Enter always inserts a new line.
Keyboard
Key
Action
Any character
Types at the caret.
Backspace / Delete
Deletes before / after the caret.
← → ↑ ↓ · Home / End
Moves the caret; ↑ ↓ move between lines.
Cmd / Ctrl + V
Pastes at the caret (see paste over the limit).
Tab / Shift + Tab
Moves focus in and out. Tab never inserts a tab character.
Shift + Enter
Inserts a new line, same as Enter.
Enter
Inserts a new line. Never submits the form.
Cmd / Ctrl + Enter
Optional: calls onSubmitShortcut, e.g. in a comment box.
ARIA
Element
Role / attribute
When
<textarea>
native multi-line textbox · id linked from <label htmlFor>
Always
<textarea>
aria-describedby="{messageId} {counterId}"
Help, counter, success or error text is shown
<textarea>
aria-invalid="true"
validationState = "error" or over the limit
<textarea>
aria-busy="true"
isLoading
<textarea>
aria-required="true" · disabled · readOnly
isRequired · isDisabled · isReadOnly
counter
aria-live="polite"
Near or over the limit only
resize handle
native, no extra ARIA
resize = "vertical"
spinner <svg>
aria-hidden="true"
isLoading
necessity *
aria-hidden="true" (required state is on the textarea)
isRequired
Agent Spec
#agent-specMachine-readable spec, tables (a)–(h). Same source as /specs/textarea.json. Anything marked UNDEFINED needs a decision before it is built.
[ "Scrollbar tokens", "Read-only look (no tokens) and resize while read-only", "Focused + invalid border (error wins, as in Text Input)", "Editable while loading (stays editable)", "maxLength block vs allow + flag (allows + flags) and counting unit (UTF-16)", "Near-limit threshold (90% as drawn in Paper)", "minRows / maxRows defaults", "Default resize (none)", "onSubmitShortcut prop name", "Chat-style Enter-to-submit (not built)", "Success border and background" ]