Textarea

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

Overview

The Textarea component is a multi-line form control for longer text entries like notes, comments, descriptions, and messages. It supports size variants, automatic height adjustment, manual resize modes, and URL state synchronization.

Usage

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

Examples

States

Textarea fields in their default, error, disabled, and readonly states.

Sizes

Auto-resize

Set a minimum row count while keeping automatic height growth.

Inline

Use variant="inline" when the textarea should read like editable text, such as an inline note, file name, or table cell.

URL State

Sync longer text values to the URL with paramName. paramDebounce delays the URL write without slowing the textarea value.


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 and applies error styling.
spellCheckbooleanfalseEnable spell checking.
classNamestringAdditional CSS classes.
styleCSSPropertiesAdditional inline styles, merged with textarea resize styles.

TextareaWrapper

Use TextareaWrapper for embedded textarea compositions that need a shared field surface around inline content.

PropTypeDefaultDescription
childrenReactNodeTextarea and embedded content to render inside.
size"sm" | "md" | "lg""md"The wrapper size, matching Textarea sizing.
classNamestringAdditional CSS classes for the wrapper element.

URL State Props

When provided with a paramName, the textarea syncs 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 | null) => voidCallback when URL parameter value changes.
paramClearOnDefaultbooleantrueRemove URL param when value equals default.
paramDebouncenumberDebounce URL updates in milliseconds.
paramThrottlenumberThrottle URL updates in milliseconds.

On this page