TextareaField
Multi-line textarea with auto-grow, manual resize, counter, and an optional rich-text (contenteditable) mode with a formatting toolbar.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<origam-textarea-field> — 6 internal parts: root ①, label ②, rich toolbar ③ (rich mode only), editing surface ④, resize grip ⑤, counter ⑥.- 1.origam-textarea-field
- Root element. Wraps the OrigamField chrome (label, messages, prepend/append).
- 2.origam-field__label
- OrigamLabel rendered above the input surface.
- 3.origam-rich-toolbar
- Formatting toolbar (rich mode only). Position top/bottom driven by toolbarPosition prop.
- 4.origam-textarea-field__surface
- The editing surface. In plain mode: a native <textarea>. In rich mode: a contenteditable div.
- 5.origam-textarea-field__grip
- Manual resize grip shown when noResize=false and autoGrow=false.
- 6.origam-textarea-field__counter
- Character counter shown when counter prop is set.
API
Props
All props accepted by this component, with their type, default value and description.
- autoGrowbooleanfalse
- Automatically grows the textarea height to fit its content (up to maxRows).
- autofocusbooleanfalse
- Focuses the textarea on mount.
- counterboolean | number | stringfalse
- Shows a character counter. Pass a number to set the max limit (shown as n/max).
- counterValuenumber | ((e: any) => number)
- persistentClearbooleanfalse
- Always shows the clear button (not just on focus/hover).
- prefixstring
- Non-editable prefix shown inside the field before the text.
- placeholderstring
- Placeholder text displayed when the field is empty.
- persistentPlaceholderbooleanfalse
- Shows the placeholder even when the field has a value.
- persistentCounterbooleanfalse
- Shows the counter even when the field is not focused.
- noResizebooleanfalse
- Disables the manual resize grip.
- rowsnumber | string5
- Initial number of visible text rows.
- maxRowsnumber | string
- Maximum rows when autoGrow is enabled. Beyond this the area scrolls.
- suffixstring
- Non-editable suffix shown inside the field after the text.
- modelModifiersstring | boolean
- Render mode. 'plain' (default) = standard <textarea>. 'rich' = contenteditable surface + formatting toolbar.
- When mode='rich', format of the emitted value. 'html' (default) emits sanitised HTML, 'markdown' emits a CommonMark subset.
- toolbarReadonlyArray<TTextareaToolbarCommand> | false
- Ordered list of toolbar commands in rich mode. Pass false to hide the toolbar entirely.
- Position of the toolbar relative to the editing surface in rich mode: 'top' or 'bottom'.
- idstring
- classstring | Array<string> | object
- stylestring | Array<string> | object | StyleValue
- color
- Active state color (focus ring, floating label).
- Adjusts the vertical padding density of the field.
- centerAffixboolean
- dirtyboolean
- disabledbooleanfalse
- Disables the textarea.
- errorstring | boolean
- inlineboolean
- labelstring
- Field label text.
- singleLineboolean
- requiredboolean
- loadingTControlLoadingValue
- tagstring
- loadingTextstring
- bgColorTColor
- appendInnerAvatarstring
- appendInnerIconTIcon
- prependInnerAvatarstring
- prependInnerIconTIcon
- clearIconTIcon
- clearableboolean
- prependInnerAriaLabelstring
- appendInnerAriaLabelstring
- borderboolean | number | string | TDirectionBoth | Array<TDirectionBoth>
- borderTopboolean | number | string
- borderLeftboolean | number | string
- borderBottomboolean | number | string
- borderRightboolean | number | string
- borderBlockboolean | number | string
- borderInlineboolean | number | string
- borderInlineStartboolean | number | string
- borderInlineEndboolean | number | string
- borderBlockStartboolean | number | string
- borderBlockEndboolean | number | string
- borderColorstring
- borderStylestring
- borderTopColorTColor
- borderRightColorTColor
- borderBottomColorTColor
- borderLeftColorTColor
- borderInlineStartColorTColor
- borderInlineEndColorTColor
- borderBlockStartColorTColor
- borderBlockEndColorTColor
- focusedboolean
- textstring
- floatingboolean
- namestring
- marginboolean | number | string
- marginTopboolean | number | string
- marginLeftboolean | number | string
- marginBottomboolean | number | string
- marginRightboolean | number | string
- marginBlockboolean | number | string
- marginInlineboolean | number | string
- marginInlineStartboolean | number | string
- marginInlineEndboolean | number | string
- marginBlockStartboolean | number | string
- marginBlockEndboolean | number | string
- paddingboolean | number | string
- paddingTopboolean | number | string
- paddingLeftboolean | number | string
- paddingBottomboolean | number | string
- paddingRightboolean | number | string
- paddingBlockboolean | number | string
- paddingInlineboolean | number | string
- paddingInlineStartboolean | number | string
- paddingInlineEndboolean | number | string
- paddingBlockStartboolean | number | string
- paddingBlockEndboolean | number | string
- roundedboolean | number | string | TRounded | null | undefined
- roundedTopRightboolean | number | string
- roundedTopLeftboolean | number | string
- roundedBottomLeftboolean | number | string
- roundedBottomRightboolean | number | string
- roundedStartStartboolean | number | string
- roundedStartEndboolean | number | string
- roundedEndStartboolean | number | string
- roundedEndEndboolean | number | string
- fontSizeTFontSize
- fontWeightTFontWeight
- lineHeightTLineHeight
- letterSpacingTLetterSpacing
- activeboolean | IStateEffectConfig
- activeClassstring
- variantTVariantInput
- elevationTElevation
- sizeTSize | number
- hideDetailsboolean | string
- hideSpinButtonsboolean
- hintstring
- Helper text below the field.
- persistentHintbooleanfalse
- Always shows the hint (not just on focus).
- messagesArray<string> | string
- heightnumber | string
- maxHeightnumber | string
- maxWidthnumber | string
- minHeightnumber | string
- minWidthnumber | string
- widthnumber | string
- directionTDirection
- errorMessagesArray<string> | string
- Validation error messages shown below the field in error state.
- maxErrorsnumber | string
- readonlybooleanfalse
- Makes the textarea non-editable.
- rulesArray<any>
- modelValueany
- Current textarea value. Synced via v-model.
- validateOnTValidateOn
- validationValueany
- appendAvatarstring
- appendIconTIcon
- prependAvatarstring
- prependIconTIcon
- prependAriaLabelstring
- appendAriaLabelstring
API
Slots
Content slots exposed by this component.
- #counter
- Replaces the character counter with custom content.
- #field
- #toolbar
- Replaces the entire rich-text toolbar (rich mode only).
- #toolbar-item
- Replaces a single toolbar button in rich mode.
- #default
- #loader
- Custom loading indicator shown while loading=true.
- #label
- Replaces the label element.
- #floatingLabel
- Replaces the floating label clone shown in the notch.
- #prefix
- #suffix
- #prependInner
- Content placed inside the field before the textarea element.
- #appendInner
- Content placed inside the field after the textarea element.
- #clear
- #details
- #prepend
- Content placed before the field (outside the input chrome).
- #append
- Content placed after the field (outside the input chrome).
- #messages
- #message
API
Emits
Events emitted by this component.
- @update:heightnumber
- Emitted when the textarea height changes in autoGrow mode.
- @click:controlMouseEvent
- Fired when the user clicks the textarea control area.
- @mousedown:controlMouseEvent
- Fired on mousedown on the control area.
- @formatTTextareaToolbarCommand, string
- Emitted when a rich-text toolbar command is applied (click or keyboard shortcut).
- @update:focusedany
- @click:appendInnerMouseEvent
- @click:prependInnerMouseEvent
- @click:clearMouseEvent
- @update:modelValueany
- Emitted on every input event.
- @click:appendMouseEvent
- @click:prependMouseEvent
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- <T extends object>(props: T, exclude?: string[]) => Partial<T>
- Utility to forward a filtered subset of props to a child component.
- Ref<string>
- Reactive CSS string generated by useStyle.
- string
- Unique style-sheet ID for this instance.
- () => void
- Injects the computed style sheet into the document.
- () => void
- Removes the injected style sheet.
- Ref<boolean>
- True once the style sheet has been injected into the DOM.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- Initial opacity of the textarea (revealed on activation to 1).
- Active textarea opacity.
- Fade-in duration for the textarea.
- Border color of the resize grip handle.
- Resting opacity of the grip handle.
- Toolbar background (tinted vs. editor surface).
- Toolbar border color.
Inclusion
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Tab | Focuses the textarea. |
| Shift+Tab | Moves focus to the previous interactive element. |
Notes
- The label prop generates an <origam-label> with a for= attribute pointing to the textarea id. Always use label or aria-label to identify the field.
- In rich mode the contenteditable div has role="textbox" aria-multiline="true". Toolbar buttons expose aria-pressed for toggle commands (bold, italic, etc.).
- When counter is set, the textarea has aria-describedby pointing to the counter element. Screen readers announce the remaining character count.
Foundation
Design tokens
Excerpt from this component's token declarations — the --origam-<component>---<property> variables, declared in its hand-maintained token sheet with no build step.
- numbervar(--origam-opacity---0)
- Initial textarea opacity (revealed on mount).
- duration0.15s
- Fade-in duration.
- colorvar(--origam-color__border---subtle)
- Resize grip border color.
- colorvar(--origam-color__surface---sunken)
- Rich toolbar background.
- dimensionvar(--origam-radius---md)
- Rich toolbar border radius.
Interactive
Playground
Edit props live and see the component update in real time. The generated code snippet updates as you change values.
Rendering the live preview…
Usage
Examples
Ready-to-paste code snippets for your templates.
Basic textarea
Auto-grow
Rich text mode
Ecosystem
Family
Components from the same folder that share conventions and often compose together.