Skip to content

Textarea โ€‹

A multi-line text input with sizes, color and visual variants, validation states, slot-overridable label and helper, JS-driven auto-resize, and an optional character counter. Toggle Vue / CSS to switch the live demo and source together.

The look is Basecoat's .textarea inside a .field (see Theme): a rounded-md box with a 1px --input border, an xs shadow, px-2.5 py-2 and text-sm, with the 3px --ring focus ring the input uses. Where upstream pins a flat min-h-16, mono derives the height from the control step โ€” T + (rows - 1) x line โ€” so a textarea starts its first line on the same baseline as an input beside it and reads as "one input tall, plus N-1 lines". Dark mode is built in.

Basic โ€‹

Default textarea with label, placeholder and helper text.

Vue SFC

Sizes โ€‹

Small, medium and large.

Vue SFC

Colors โ€‹

Pick a colour and every variant takes it โ€” all built-in colours, combined with outlined, filled and underlined.

underlined focuses with a soft glow under the line rather than a ring around the field โ€” tune it with --mono-textarea-underline-glow (default 0 5px 6px -6px).

Vue SFC

States โ€‹

Disabled, readonly and required.

Vue SFC

Validation โ€‹

valid, invalid and warning states with messages.

Vue SFC

Auto resize โ€‹

Grow with content between min-rows and max-rows.

Vue SFC

Counter โ€‹

Live character count via show-counter and max-length.

Vue SFC

Slots โ€‹

Custom label and helper content via named slots.

Vue SFC

Event log โ€‹

Live log of input and change events.

Vue SFC

Customized โ€‹

Override per-element styling with cssClass (Vue) or extra utility classes (CSS).

Vue SFC

Width & height โ€‹

Set width, height, min-width, max-width, min-height or max-height โ€” each takes a CSS string ("320px", "80%") or a number (px). Fields are full width by default; set width to constrain.

Vue SFC

CSS Variables โ€‹

Vue SFC

Every textarea is themed through --mono-textarea-* custom properties. Setting one on the element, on any wrapper/ancestor, or inline all work โ€” custom properties inherit, and they pierce the shadow-DOM boundary, so the same overrides apply to <mono-textarea> and the shadow build. The color prop sets the focus colour, but an explicit --mono-textarea-ring-color (or the legacy -focus-color) always wins. To re-skin globally, set the underlying tokens (--input, --ring, --destructive โ€ฆ) โ€” or switch flavor. Scroll areas use the shared --mono-scrollbar-* tokens.

VariableDefaultControls
--mono-textarea-ring-color (alias -focus-color) / -ring-width / -ring-alpha--ring / --mono-ring-width / --mono-ring-alphaThe focus ring (set by color)
--mono-textarea-border-color (alias -rest-border) / -border-width--input / --mono-border-widthField border
--mono-textarea-bg (alias -surface)--mono-mode-surface (transparent, dark --input/30)Field background
--mono-textarea-shadow / --mono-textarea-radius--mono-shadow-xs / --mono-radius-mdField shadow and corner
--mono-textarea-padding-x-<size> / --mono-textarea-padding-y2.5 ร— --mono-spacing at md / derivedField padding (the Y is (T - line) / 2 - border)
--mono-textarea-font-<size> / --mono-textarea-line-height--mono-text-sm at md / --mono-leading-normalField type
--mono-textarea-rows-<size> (or -rows)4 at md, 3 at xs/smHow many lines the resting box shows
--mono-textarea-height-<size> / --mono-textarea-min-height--mono-control-height-<size> / derivedThe T in the derivation, or an outright override
--mono-textarea-resizevertical (none while auto-resize)The resize grip
--mono-textarea-gap3 ร— --mono-spacingLabel โ†” field โ†” footer
--mono-textarea-label-* / --mono-textarea-message-* / --mono-textarea-counter-font-size--mono-text-sm / --mono-text-sm / --mono-text-xsLabel, message and counter type
--mono-textarea-text / -placeholder / -muted--foreground / --muted-foregroundInk
--mono-textarea-valid / -invalid / -warning--success / --destructive / --warningValidation colours
--mono-textarea-filled-bg / -disabled-bg / -readonly-bg--input/50 / โ€” / --mutedThe filled variant and the two read-only-ish states

Deprecated and honoured as no-ops until 2.0: --mono-textarea-focus-rgb and every other *-rgb (use color-mix), --mono-textarea-underline-glow (the underlined variant rides the bottom edge now), --mono-textarea-background (use -bg), --mono-textarea-border (use -border-color).

Types โ€‹

Importimport { TextareaProps } from 'mono-helper'
PropValueDefaultDescription
modelValuestringโ€”Two-way bound text value of the textarea.
valuestringโ€”Text value (kept in sync with modelValue).
namestringโ€”Form field name for the underlying textarea.
placeholderstringโ€”Placeholder text shown when empty.
labelstringโ€”Text label shown above the textarea.
helperTextstringโ€”Helper text shown below the textarea.
validationState'warning' | 'default' | 'valid' | 'invalid'โ€”Validation state controlling field styling.
validationMessagestringโ€”Message shown for the current validation state.
errorMessagestringโ€”Error message that forces the invalid state.
successMessagestringโ€”Success message that forces the valid state.
size'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl'โ€”Size of the textarea.
color'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info' | 'teal' | 'purple' | 'neutral' | 'dark'โ€”Color theme of the textarea.
variant'underlined' | 'outlined' | 'filled'โ€”Visual style of the textarea.
disabledbooleanโ€”Disables interaction with the textarea.
readonlybooleanโ€”Makes the textarea read-only.
requiredbooleanโ€”Marks the field as required.
autofocusbooleanโ€”Focuses the textarea on first render.
autoResizebooleanโ€”Automatically grows the height to fit content.
rowsnumberโ€”Initial number of visible text rows.
minRowsnumberโ€”Minimum number of rows when auto-resizing.
maxRowsnumberโ€”Maximum number of rows when auto-resizing.
minLengthnumberโ€”Minimum allowed character length.
maxLengthnumberโ€”Maximum allowed character length.
showCounterbooleanโ€”Shows a character counter below the field.
ariaLabelTextstringโ€”Accessible label for screen readers.
ariaLabelstringโ€”โ€”
widthstring | numberโ€”Explicit sizing. Each accepts a CSS length string (`"320px"`, `"80%"`) or a number (interpreted as px). Use `width="100%"` for a full-width field.
heightstring | numberโ€”โ€”
minWidthstring | numberโ€”โ€”
maxWidthstring | numberโ€”โ€”
minHeightstring | numberโ€”โ€”
maxHeightstring | numberโ€”โ€”
cssClassTextareaCssClassโ€”Per-part class overrides for styling internal elements.
visiblebooleanโ€”Whether the control is shown. Defaults to `true`.
visibleType'none' | 'invisible'โ€”How it hides when `visible` is `false`. Defaults to `'none'`.