Skip to content

BbTextarea

Captures multi-line text values.

import { BbTextarea } from 'bitboss-ui';

On this page

Props

NameDescription
append:icon Type: string

Name of the icon to be added at the end of the input.

autocomplete Type: string

Guides to the browser as to the type of information expected in the field.

autofocus Type: Booleanish

Focuses the field when it mounts (a dialog already open included), unless the user is typing in another field.

autoGrow Type: boolean

Expands the textarea to match its content. Empty, it is one BbTextInput tall (text on the same line); it never shrinks below that, or below rows.

Grows the field to fit its content, animated through BbSmoothHeight. Combine it with rows instead of a CSS min-height: a min-height fights the growth calculation, rows feeds it.

See example
clearable Type: booleanDefaultall.clearable (false)

Displays a clear button when the input has a value and is being interacted with.

Same behaviour as on BbTextInput: no clear event, the model goes null and value-commit fires with it.

See example
compact Type: boolean

Compact density: the field uses the -compact twins of --bb-input-h, --bb-input-py and --bb-label-spacing-y, so a --bb-input-h set on the component is ignored while it is on. Size a compact field with --bb-input-h-compact (and --bb-input-py-compact).

See example
counter Type: booleanDefaultfalse

Shows a character count at the end of the hint row: 42, or 42 / 140 with the native maxlength (which also stops input). It brightens from 90 % and takes the warning colour at the limit; screen readers hear it only when it crosses 90 % or the limit.

description Type: string

Text between the label and the input. Unlike the hint it is always visible; it joins the input's aria-describedby after any errors / warnings, before the hint.

See example
disabled Type: booleanDefaultfalse

Disables the component.

errors Type: string | string[]

Error messages under the field, a string or array, in an aria-live="polite" region and first in the control's aria-describedby, so they are re-read when it regains focus.

The home for a soft character limit: leave maxlength off and say what to cut here. A suffix counter is visual only.

See example
formless Type: booleanDefaultfalse

Keep this control out of the enclosing BbForm entirely: not submitted, not dirty, not reset, not validated. For a control that is not form data (a filter, a "show advanced" switch).

hasErrors Type: booleanDefaultfalse

Define if the component should be in an error state. It usually attaches a CSS class for styling purposes.

hasWarnings Type: booleanDefaultfalse

Define if the component should be in a warning state. Same chrome as errors with --bb-warn; errors take priority.

hideLabel Type: booleanDefaultfalse

Visually hides the label of the input while maintaining accessibility. Pair it with a placeholder: an empty field otherwise shows nothing saying what it is for.

hint Type: string

Text box to be displayed near the input, usually to indicate instructions.

See example
id Type: string

The id of the native control; the label's for and the description and message ids derive from it. Generated when omitted.

inputAlign Type: FieldCrossAlign

Vertical position of the control in a side-by-side row; not inputPosition, the horizontal one. Omitted, 'top'.

label requiredType: string

Text content of the label of the element.

Required, and display and accessibility only: it does not set name.

See example
labelAlign Type: FieldCrossAlign

Vertical position of the label block in a side-by-side row; not labelPosition, the horizontal one. Omitted, 'top'.

labelMode Type: "outside" | "floating" | "inside"

Label rendering mode. 'outside' (default) sits the label above/beside the field; 'floating'/'inside' overlay it, like the other text inputs.

Works exactly as on BbTextInput, including the all.labelMode fallback from the plugin's components map. A bare floating attribute is not a prop: write label-mode="floating".

See example
labelPosition Type: "end" | "start" | "center" | "left" | "right"Default'start'

Text alignment of the label. 'start' / 'end' follow the page direction (the inline start is the left in a left-to-right page, the right in a right-to-left one); 'left' / 'right' stay physical; 'center' centres it. The default, 'start', follows the page direction.

layout Type: Responsive<FieldLayout>

How label and input sit together: 'vertical', 'horizontal' (50/50), 'auto', 'label-fill', 'input-fill', a ratio like 'xx xxxxx', or a per-breakpoint map ({ default: 'vertical', md: 'xx xxxxx' }).

Applies only while the resolved label mode is outside; floating and inside force the vertical layout and ignore it silently. A label beside a four-line box is what makes this component good for settings rows.

See example
loading Type: booleanDefaultfalse

Sets the component in a loading state, usually triggering some visual styles.

Visual only: the field stays editable during an autosave round-trip.

See example
modelValue Type: string | null

Used by v-model.

name Type: string

Defines the name of the input.

Unset, the rendered <textarea> carries no name, so a native form post drops the value silently.

See example
nullValue Type: 'null' | 'string'

What the field emits once the user empties it (typing it empty, the clear button): 'null' emits null, 'string' emits ''. Unset, the plugin's components.BbTextarea.nullValue applies ('null' by default). Also types the update:modelValue payload: with 'string' it is string.

persistentHint Type: booleanDefaultfalse

Keeps the hint displayed.

placeholder Type: string

Text shown while the field is empty.

prefix Type: string

Text in the box before the value (€, https://). The #prefix slot wins when both are set; icons and buttons go in the slot.

prepend:icon Type: string

Name of the icon to be added at the start of the input.

pt Type: (PtCompoundOf<"", { readonly parts: readonly ["root", "label", "description", "message", "hint", "box", "input", "icon", "spinner", "prefix", "suffix", "clear", "counter"]; readonly states: readonly ["hasValue", "nearLimit", "atLimit", ...("disabled" | "loading" | "errors" | "warnings" | "readonly" | "hasValue")[]]; readonly wide: readonly ["hasValue", "nearLimit", "atLimit", "readonly", "disabled", "warnings", "errors", "loading"]; readonly except: { readonly clear: readonly ["disabled", "readonly"]; }; readonly variant: { readonly names: readonly ["outline", "secondary", "ghost"]; readonly option: "textareaVariants"; readonly parts: readonly ["root", "label", "description", "message", "hint", "box", "input", "icon", "spinner", "prefix", "suffix", "clear"]; }; }> & { input?: PtValue | undefined; label?: PtValue | undefined; prefix?: PtValue | undefined; root?: PtValue | undefined; icon?: PtValue | undefined; "root:disabled"?: PtValue | undefined; "icon:disabled"?: PtValue | undefined; spinner?: PtValue | undefined; clear?: PtValue | undefined; "root:loading"?: PtValue | undefined; "icon:loading"?: PtValue | undefined; "spinner:loading"?: PtValue | undefined; "clear:loading"?: PtValue | undefined; "root:errors"?: PtValue | undefined; "root:warnings"?: PtValue | undefined; "root:readonly"?: PtValue | undefined; "spinner:disabled"?: PtValue | undefined; description?: PtValue | undefined; message?: PtValue | undefined; hint?: PtValue | undefined; "label:disabled"?: PtValue | undefined; "label:errors"?: PtValue | undefined; "label:warnings"?: PtValue | undefined; "label:readonly"?: PtValue | undefined; "icon:errors"?: PtValue | undefined; "icon:warnings"?: PtValue | undefined; "icon:readonly"?: PtValue | undefined; "description:disabled"?: PtValue | undefined; "description:errors"?: PtValue | undefined; "description:warnings"?: PtValue | undefined; "description:readonly"?: PtValue | undefined; "message:disabled"?: PtValue | undefined; "message:errors"?: PtValue | undefined; "message:warnings"?: PtValue | undefined; "message:readonly"?: PtValue | undefined; "hint:disabled"?: PtValue | undefined; "hint:errors"?: PtValue | undefined; "hint:warnings"?: PtValue | undefined; "hint:readonly"?: PtValue | undefined; "label:loading"?: PtValue | undefined; "label:hasValue"?: PtValue | undefined; "root:hasValue"?: PtValue | undefined; "icon:hasValue"?: PtValue | undefined; "description:loading"?: PtValue | undefined; "description:hasValue"?: PtValue | undefined; "message:loading"?: PtValue | undefined; "message:hasValue"?: PtValue | undefined; "hint:loading"?: PtValue | undefined; "hint:hasValue"?: PtValue | undefined; box?: PtValue | undefined; suffix?: PtValue | undefined; "input:disabled"?: PtValue | undefined; "input:loading"?: PtValue | undefined; "input:errors"?: PtValue | undefined; "input:warnings"?: PtValue | undefined; "input:readonly"?: PtValue | undefined; "input:hasValue"?: PtValue | undefined; "prefix:disabled"?: PtValue | undefined; "prefix:loading"?: PtValue | undefined; "prefix:errors"?: PtValue | undefined; "prefix:warnings"?: PtValue | undefined; "prefix:readonly"?: PtValue | undefined; "prefix:hasValue"?: PtValue | undefined; "spinner:errors"?: PtValue | undefined; "spinner:warnings"?: PtValue | undefined; "spinner:readonly"?: PtValue | undefined; "spinner:hasValue"?: PtValue | undefined; "clear:errors"?: PtValue | undefined; "clear:warnings"?: PtValue | undefined; "clear:hasValue"?: PtValue | undefined; "box:disabled"?: PtValue | undefined; "box:loading"?: PtValue | undefined; "box:errors"?: PtValue | undefined; "box:warnings"?: PtValue | undefined; "box:readonly"?: PtValue | undefined; "box:hasValue"?: PtValue | undefined; "suffix:disabled"?: PtValue | undefined; "suffix:loading"?: PtValue | undefined; "suffix:errors"?: PtValue | undefined; "suffix:warnings"?: PtValue | undefined; "suffix:readonly"?: PtValue | undefined; "suffix:hasValue"?: PtValue | undefined; counter?: PtValue | undefined; "input:nearLimit"?: PtValue | undefined; "input:atLimit"?: PtValue | undefined; "label:nearLimit"?: PtValue | undefined; "label:atLimit"?: PtValue | undefined; "prefix:nearLimit"?: PtValue | undefined; "prefix:atLimit"?: PtValue | undefined; "root:nearLimit"?: PtValue | undefined; "root:atLimit"?: PtValue | undefined; "icon:nearLimit"?: PtValue | undefined; "icon:atLimit"?: PtValue | undefined; "spinner:nearLimit"?: PtValue | undefined; "spinner:atLimit"?: PtValue | undefined; "description:nearLimit"?: PtValue | undefined; "description:atLimit"?: PtValue | undefined; "message:nearLimit"?: PtValue | undefined; "message:atLimit"?: PtValue | undefined; "hint:nearLimit"?: PtValue | undefined; "hint:atLimit"?: PtValue | undefined; "box:nearLimit"?: PtValue | undefined; "box:atLimit"?: PtValue | undefined; "suffix:nearLimit"?: PtValue | undefined; "suffix:atLimit"?: PtValue | undefined; "counter:disabled"?: PtValue | undefined; "counter:loading"?: PtValue | undefined; "counter:errors"?: PtValue | undefined; "counter:warnings"?: PtValue | undefined; "counter:readonly"?: PtValue | undefined; "counter:hasValue"?: PtValue | undefined; "counter:nearLimit"?: PtValue | undefined; "counter:atLimit"?: PtValue | undefined; "clear:nearLimit"?: PtValue | undefined; "clear:atLimit"?: PtValue | undefined; } & { "root:outline"?: PtValue | undefined; "icon:outline"?: PtValue | undefined; "root:secondary"?: PtValue | undefined; "icon:secondary"?: PtValue | undefined; "spinner:outline"?: PtValue | undefined; "spinner:secondary"?: PtValue | undefined; "clear:outline"?: PtValue | undefined; "clear:secondary"?: PtValue | undefined; "root:ghost"?: PtValue | undefined; "icon:ghost"?: PtValue | undefined; "spinner:ghost"?: PtValue | undefined; "label:outline"?: PtValue | undefined; "description:outline"?: PtValue | undefined; "message:outline"?: PtValue | undefined; "hint:outline"?: PtValue | undefined; "input:outline"?: PtValue | undefined; "input:secondary"?: PtValue | undefined; "input:ghost"?: PtValue | undefined; "label:secondary"?: PtValue | undefined; "label:ghost"?: PtValue | undefined; "prefix:outline"?: PtValue | undefined; "prefix:secondary"?: PtValue | undefined; "prefix:ghost"?: PtValue | undefined; "clear:ghost"?: PtValue | undefined; "description:secondary"?: PtValue | undefined; "description:ghost"?: PtValue | undefined; "message:secondary"?: PtValue | undefined; "message:ghost"?: PtValue | undefined; "hint:secondary"?: PtValue | undefined; "hint:ghost"?: PtValue | undefined; "box:outline"?: PtValue | undefined; "box:secondary"?: PtValue | undefined; "box:ghost"?: PtValue | undefined; "suffix:outline"?: PtValue | undefined; "suffix:secondary"?: PtValue | undefined; "suffix:ghost"?: PtValue | undefined; })

Passthrough, object form: { box: '…', 'box:errors': '…' } — the same keys as the pt:* attributes without the prefix. See the pt:<part> row.

pt:<part> Type: PtValue

Passthrough, attribute form: one attribute per part, pt:<part>, and per part and state, pt:<part>:<state>. Parts: box, clear, counter, description, hint, icon, input, label, message, prefix, root, spinner, suffix. States: atLimit, disabled, errors, ghost, hasValue, loading, nearLimit, outline, readonly, secondary, warnings.

See example
readonly Type: booleanDefaultfalse

Sets the input in a readonly state.

required Type: booleanDefaultfalse

Sets the input as required. Outside a BbForm it forwards to the native textarea; inside one it only marks the field (asterisk, aria-required) and nothing enforces it: use rules="required" or the form schema.

reverse Type: boolean

Reverses the layout. Applicable in every direction the order of the label and the input is swapped.

rows Type: string | number

Sets the number of visible text lines for the control.

On its own, a fixed height with no resize handle. With auto-grow, the floor the field starts at and never shrinks below. With neither, the box is 150px tall: a height, not a minimum, so a height you set on the field or pt:input replaces it.

See example
rules Type: RuleExpression<string | null>

vee-validate rules for this field. Only inside a BbForm.

Read only inside a BbForm; outside one they do nothing. The field checks itself when you leave it (validation-mode="balanced"), then on every keystroke while it shows an error.

suffix Type: string

Text in the box after the value (kg, .com). The #suffix slot wins when both are set; icons and buttons go in the slot.

validationLabel Type: string

The field's name in validation messages ({field}): "Email is not valid". Defaults to the label (or legend), then "This field"; never the name. Set it when the label is hidden or reads badly in a sentence (icon-only, a question). BbForm only.

validationMode Type: ValidationMode

When the field validates: aggressive (each change), balanced (on leave, then live while in error), lazy (on leave), submit-only, submit-live. Unset: the BbForm's validation-mode, then all.validationMode ('balanced'). BbForm only.

variant Type: InputVariantOf<TextareaVariantRegistry>Default'outline'

The field box's look, with BbButton's names and tokens. Colours only, so a form never reflows; 'ghost' has no border in any state, 'none' no look at all (you own hover, focus and the states). Register more with the plugin's components.BbTextarea.variants.

warnings Type: string | string[]

Warning messages under the field, a string or array: amber, in their own aria-live region and in the control's aria-describedby after the errors. Non-empty turns on the warning state; errors win when both are set.

See example

v-model

Values kept in sync through v-model.

NameDescription
modelValue Type: string | null

string | null, like every field in the family: emptied means null, or '' with null-value="string" or the plugin's components.BbTextarea.nullValue. Optional inside a BbForm, which holds the value under name.

See example

Events

NameDescription
blur Type: (event: FocusEvent): void

Emitted when the native textarea loses focus. Forwards the original DOM FocusEvent.

change Type: (event: Event): void

Emitted when the native textarea fires a change event. Forwards the original DOM Event.

click Type: (event: MouseEvent): void

Emitted when the textarea receives a click interaction. Forwards the original DOM MouseEvent.

compositionend Type: (event: CompositionEvent): void

An IME composition ended. Forwards the original DOM CompositionEvent.

compositionstart Type: (event: CompositionEvent): void

An IME composition started. Forwards the original DOM CompositionEvent.

focus Type: (event: FocusEvent): void

Emitted when the native textarea gains focus. Forwards the original DOM FocusEvent.

input Type: (event: Event): void

Emitted on native input events from the textarea. Forwards the original DOM Event.

Also stopPropagation()d, so an ancestor listening across a whole form will not hear this field. Bind here, or watch the model.

See example
keydown Type: (event: KeyboardEvent): void

Emitted for keyboard interaction on the textarea. Forwards the original DOM KeyboardEvent.

Forwarded, but not bubbled: the component calls stopPropagation() on keydown, so no ancestor handler sees the key: not a form-level ⌘+Enter shortcut, not a dialog listening for Escape. Wire the action to a button.

See example
keyup Type: (event: KeyboardEvent): void

Emitted for keyboard interaction on the textarea. Forwards the original DOM KeyboardEvent.

mousedown Type: (event: MouseEvent): void

Emitted when a pointing device button is pressed over the textarea. Forwards the original DOM MouseEvent.

mouseup Type: (event: MouseEvent): void

Emitted when a pointing device button is released over the textarea. Forwards the original DOM MouseEvent.

paste Type: (event: ClipboardEvent): void

Native clipboard paste. Forwards the original DOM ClipboardEvent.

update:modelValue Type: (value: string | NullValueOf<E>): void

Emitted when the value changes. Carries the new text, or the empty value (null-value, else the app's, null by default) when emptied.

value-commit Type: (value: string | NullValueOf<E>): void

Emitted when the user commits the text: where the native change fires (blur or Enter after editing) and on the clear button, after update:modelValue and change, with the value after the v-model modifiers. Only when it differs from the value on focus; never for a value you set.

The hook for saving: once when the user leaves the field or clears it, never for a value your code writes.

See example

Slots

The listed properties are the ones exposed to the slot scope.

NameDescription
append Type: Record<string, never>

Content rendered after the textarea, at the end of the inner container.

append:outer Type: Record<string, never>

Content rendered after the entire textarea control, outside the input chrome.

description Type: BbTextareaDescriptionSlotProps

Replaces the description text. Provided alone (no description prop) it still renders the description region and wires it into aria-describedby.

hint Type: BbTextareaDescriptionSlotProps

Replaces the hint text; alone it still renders the row. May hold an action.

label Type: BbTextareaLabelSlotProps

Replaces the default label text rendered above the textarea.

prefix Type: Record<string, never>

Inline content rendered at the start of the textarea field area, before the text.

prepend Type: Record<string, never>

Content rendered before the textarea, at the start of the inner container.

prepend:outer Type: Record<string, never>

Content rendered before the entire textarea control, outside the input chrome.

suffix Type: Record<string, never>

Inline content rendered at the end of the textarea field area, after the text.

The home for a character counter: beside the value rather than below it, where it would compete with the hint.

See example

Renamed and removed

Names from v2 and from earlier 3.0 betas that no longer work, and what to write instead.

  • slotappend-outerappend:outerfails silently
  • directionlayoutfails silently
  • hasWarninghasWarningsfails silently
  • slotprepend-outerprepend:outerfails silently
  • validateOnvalidationModefails silently

    An array of events became one mode (aggressive | balanced | lazy | submit-only | submit-live). The old defaults (['blur'], ['inactive'], a toggle's ['update:modelValue', 'change', 'blur']) are balanced, the new default: delete the prop. A text field on ['update:modelValue'] is validation-mode="aggressive". Set it once on <BbForm validation-mode> instead of per field.

  • vidremovedfails silently

    A display name (v2: vid="Email address") is now validation-label; a field path (3.0 betas: vid="address.city") is now name (brackets for a native post: address[city]). check --fix picks by the value.