Appearance
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
Tooltip β
When the extra explanation is too long for helper-text, put it behind an info icon at the end of the label. tooltip="β¦" takes plain text; :tooltip.prop="{ content, placement, color, β¦ }" takes any tooltip option. The icon is keyboard-focusable and also works on a disabled field β a good place to say why it is disabled.
Plain text needs nothing extra
tooltip="β¦" (plain text) shows a small built-in bubble β no dependency. It sits above the icon (below when there's no room), stays on screen, and isn't clipped by an overflow: hidden parent. It reads the tooltip addon's --mono-tooltip-bg / -color / -radius / -max-width / -font-size / -padding-x / -padding-y knobs.
The object form is the tooltip addon (mono-tooltip: placement, color, delayβ¦), which needs the optional peers pnpm add @floating-ui/dom @floating-ui/core. Without them an object-form tooltip renders no icon (and nothing is logged). Either way the icon only appears beside a label.
Vue SFC
Label position β
label-position moves the label without touching its type or colours:
| value | look |
|---|---|
top | above the box (default) |
notched | outlined: on the top border, ββLabelββ. filled / underlined: inset inside the top of the box, which grows by the label's line |
left / right | beside the box, centred on its first row; helper / validation messages stay under the box |
Set it for every field at once with createMonoUI({ 'mono-textarea': { labelPosition: 'notched' } }). --mono-textarea-label-width fixes the side column so a stack of left fields lines up.
The notch is a background patch
The notch hides the border with --background. On a card or any other surface, set --mono-textarea-label-notch-bg to that surface (e.g. var(--card)).
Vue SFC
Validation position β
validation-position decides where the validation message (invalid / warning / valid + validation-message) shows. The coloured border is the same in every mode.
| value | look |
|---|---|
bottom | the row under the box (default) β the message replaces the helper text there |
icon | a state icon inside the box; hover or tap it (or keyboard-focus the field) for the message in a state-coloured bubble |
float | nothing until the field is hovered or focused; then the message floats under the box, and disappears again when you leave |
In icon and float the row under the box keeps the helper text, and the message stays there for screen readers only. The bubbles need no dependency (no floating-ui). Knobs: --mono-validation-invalid-bg / -color (and warning / valid), --mono-validation-icon-size.
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.
| Variable | Default | Controls |
|---|---|---|
--mono-textarea-ring-color (alias -focus-color) / -ring-width / -ring-alpha | --ring / --mono-ring-width / --mono-ring-alpha | The focus ring (set by color) |
--mono-textarea-border-color (alias -rest-border) / -border-width | --input / --mono-border-width | Field 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-md | Field shadow and corner |
--mono-textarea-padding-x-<size> / --mono-textarea-padding-y | 2.5 Γ --mono-spacing at md / derived | Field padding (the Y is (T - line) / 2 - border) |
--mono-textarea-font-<size> / --mono-textarea-line-height | --mono-text-sm at md / --mono-leading-normal | Field type |
--mono-textarea-rows-<size> (or -rows) | 4 at md, 3 at xs/sm | How many lines the resting box shows |
--mono-textarea-height-<size> / --mono-textarea-min-height | --mono-control-height-<size> / derived | The T in the derivation, or an outright override |
--mono-textarea-resize | vertical (none while auto-resize) | The resize grip |
--mono-textarea-gap | 3 Γ --mono-spacing | Label β field β footer |
--mono-textarea-label-* / --mono-textarea-message-* / --mono-textarea-counter-font-size | --mono-text-sm / --mono-text-sm / --mono-text-xs | Label, message and counter type |
--mono-textarea-text / -placeholder / -muted | --foreground / --muted-foreground | Ink |
--mono-textarea-valid / -invalid / -warning | --success / --destructive / --warning | Validation colours |
--mono-textarea-filled-bg / -disabled-bg / -readonly-bg | --input/50 / β / --muted | The 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 β
Import
import { TextareaProps } from '@mono-lit/helper'| Prop | Value | Default | Description |
|---|---|---|---|
modelValue | string | β | Two-way bound text value of the textarea. |
value | string | β | Text value (kept in sync with modelValue). |
name | string | β | Form field name for the underlying textarea. |
placeholder | string | β | Placeholder text shown when empty. |
label | string | β | Text label shown above the textarea. |
helperText | string | β | Helper text shown below the textarea. |
tooltip | string | MonoTooltipOptions | β | Info icon at the end of the label; hovering, focusing or tapping it shows this text. Plain text β a small built-in bubble (no dependency). Full tooltip options (`:tooltip.prop="{ content, placement, color }"`) β a `mono-tooltip`, which needs the optional `@floating-ui/dom` + `@floating-ui/core` peers (without them that form renders no icon). Shown only beside a label. |
validationState | 'warning' | 'default' | 'invalid' | 'valid' | β | Validation state controlling field styling. |
validationMessage | string | β | Message shown for the current validation state. |
errorMessage | string | β | Error message that forces the invalid state. |
successMessage | string | β | 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. |
labelPosition | 'left' | 'right' | 'top' | 'notched' | β | Where the label sits: `top` (above the box, default), `notched` (on the top border for outlined; inset inside the box for filled / underlined), or `left` / `right` of the box. Knobs: `--mono-textarea-label-width`, `-label-side-gap`, `-label-notch-font-size`, `-label-notch-bg`. |
validationPosition | 'bottom' | 'icon' | 'float' | β | Where the validation message shows. `bottom` (default): the row under the box. `icon`: a state icon inside the box; hover / tap / keyboard focus shows the message in a state-coloured bubble. `float`: the message floats under the box only while the field is hovered or focused. In `icon` / `float` the row under the box keeps the helper text. |
disabled | boolean | β | Disables interaction with the textarea. |
readonly | boolean | β | Makes the textarea read-only. |
required | boolean | β | Marks the field as required. |
autofocus | boolean | β | Focuses the textarea on first render. |
autoResize | boolean | β | Automatically grows the height to fit content. |
rows | number | β | Initial number of visible text rows. |
minRows | number | β | Minimum number of rows when auto-resizing. |
maxRows | number | β | Maximum number of rows when auto-resizing. |
minLength | number | β | Minimum allowed character length. |
maxLength | number | β | Maximum allowed character length. |
showCounter | boolean | β | Shows a character counter below the field. |
ariaLabelText | string | β | Accessible label for screen readers. |
ariaLabel | string | β | β |
width | string | 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. |
height | string | number | β | β |
minWidth | string | number | β | β |
maxWidth | string | number | β | β |
minHeight | string | number | β | β |
maxHeight | string | number | β | β |
cssClass | TextareaCssClass | β | Per-part class overrides for styling internal elements. |
visible | boolean | β | Whether the control is shown. Defaults to `true`. |
visibleType | 'none' | 'invisible' | β | How it hides when `visible` is `false`. Defaults to `'none'`. |