Textarea

A multi-line text input with auto-resize capabilities and URL state support.

Overview

The Textarea component provides a multi-line text input field with automatic height adjustment, size variants, and URL state management support. It's perfect for longer text entries like comments, descriptions, or messages.

Usage

import { Textarea } from "@tilt-legal/cubitt-components/primitives";
<Textarea placeholder="Enter your message..." />

Examples

Basic

States

Textarea supports disabled, read-only, and invalid states.

Sizes

Auto-resize

Control the height behavior with minRows and maxRows props.


API Reference

Textarea

The textarea component with auto-resize and URL state management.

PropTypeDefaultDescription
valuestringThe controlled value of the textarea.
defaultValuestringThe default value when uncontrolled.
onChange(event: ChangeEvent<HTMLTextAreaElement>) => voidCallback fired when the value changes.
placeholderstringPlaceholder text when empty.
size"sm" | "md" | "lg""md"The size variant of the textarea.
variant"default" | "inline""default"The visual variant of the textarea.
minRowsnumber2Minimum number of visible text lines.
maxRowsnumberMaximum number of visible text lines.
resizetrue | "none" | "both" | "horizontal" | "vertical" | "block" | "inline""none"Resize behavior of the textarea.
disabledbooleanfalseWhether the textarea is disabled.
readOnlybooleanfalseWhether the textarea is read-only.
aria-invalidbooleanIndicates validation state, applies error styling when true.
spellCheckbooleanfalseEnable spell checking.
classNamestringAdditional CSS classes.

URL State Props

When provided with a paramName, the textarea will sync its value with URL parameters via TanStack Router search params.

PropTypeDefaultDescription
paramNamestringURL parameter name for syncing state with URL. Enables URL state management.
paramValuestringControlled value for the URL parameter.
onUrlValueChange(value: string) => voidCallback when URL parameter value changes.
paramClearOnDefaultbooleantrueRemove URL param when value equals default.
paramDebouncenumberDebounce URL updates in milliseconds (recommended for textareas).
paramThrottlenumberThrottle URL updates in milliseconds.

On this page