TextareaField

Form & Input
stable

Multi-line textarea with auto-grow, manual resize, counter, and an optional rich-text (contenteditable) mode with a formatting toolbar.

Structure

Anatomie

Décomposition visuelle de la structure interne du composant avec les appels de classes BEM.

Anatomy of OrigamTextareaFieldSchematic of the TextareaField component with 6 numbered internal parts. Description B I U code link ≡ 1. ▼H Start typing rich content here… 0 / 500 1 2 3 4 5 6 origam-textarea-field
Anatomy of <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

Toutes les props acceptées par ce composant, avec leur type, valeur par défaut et description.

autoGrow
boolean
false
Automatically grows the textarea height to fit its content (up to maxRows).
autofocus
boolean
false
Focuses the textarea on mount.
counter
boolean | number | string
false
Shows a character counter. Pass a number to set the max limit (shown as n/max).
counterValue
number | ((e: any) => number)
persistentClear
boolean
false
Always shows the clear button (not just on focus/hover).
prefix
string
Non-editable prefix shown inside the field before the text.
placeholder
string
Placeholder text displayed when the field is empty.
persistentPlaceholder
boolean
false
Shows the placeholder even when the field has a value.
persistentCounter
boolean
false
Shows the counter even when the field is not focused.
noResize
boolean
false
Disables the manual resize grip.
rows
number | string
5
Initial number of visible text rows.
maxRows
number | string
Maximum rows when autoGrow is enabled. Beyond this the area scrolls.
suffix
string
Non-editable suffix shown inside the field after the text.
modelModifiers
string | boolean
mode
'plain'
Render mode. 'plain' (default) = standard <textarea>. 'rich' = contenteditable surface + formatting toolbar.
output
'html'
When mode='rich', format of the emitted value. 'html' (default) emits sanitised HTML, 'markdown' emits a CommonMark subset.
toolbar
ReadonlyArray<TTextareaToolbarCommand> | false
Ordered list of toolbar commands in rich mode. Pass false to hide the toolbar entirely.
toolbarPosition
'top'
Position of the toolbar relative to the editing surface in rich mode: 'top' or 'bottom'.
id
string
class
string | Array<string> | object
style
string | Array<string> | object | StyleValue
color
Active state color (focus ring, floating label).
density
'default'
Adjusts the vertical padding density of the field.
centerAffix
boolean
dirty
boolean
disabled
boolean
false
Disables the textarea.
error
string | boolean
inline
boolean
label
string
Field label text.
singleLine
boolean
required
boolean
loading
TControlLoadingValue
tag
string
loadingText
string
bgColor
TColor
appendInnerAvatar
string
appendInnerIcon
TIcon
prependInnerAvatar
string
prependInnerIcon
TIcon
clearIcon
TIcon
clearable
boolean
prependInnerAriaLabel
string
appendInnerAriaLabel
string
border
boolean | number | string | TDirectionBoth | Array<TDirectionBoth>
borderTop
boolean | number | string
borderLeft
boolean | number | string
borderBottom
boolean | number | string
borderRight
boolean | number | string
borderBlock
boolean | number | string
borderInline
boolean | number | string
borderInlineStart
boolean | number | string
borderInlineEnd
boolean | number | string
borderBlockStart
boolean | number | string
borderBlockEnd
boolean | number | string
borderColor
string
borderStyle
string
borderTopColor
TColor
borderRightColor
TColor
borderBottomColor
TColor
borderLeftColor
TColor
borderInlineStartColor
TColor
borderInlineEndColor
TColor
borderBlockStartColor
TColor
borderBlockEndColor
TColor
focused
boolean
text
string
floating
boolean
name
string
margin
boolean | number | string
marginTop
boolean | number | string
marginLeft
boolean | number | string
marginBottom
boolean | number | string
marginRight
boolean | number | string
marginBlock
boolean | number | string
marginInline
boolean | number | string
marginInlineStart
boolean | number | string
marginInlineEnd
boolean | number | string
marginBlockStart
boolean | number | string
marginBlockEnd
boolean | number | string
padding
boolean | number | string
paddingTop
boolean | number | string
paddingLeft
boolean | number | string
paddingBottom
boolean | number | string
paddingRight
boolean | number | string
paddingBlock
boolean | number | string
paddingInline
boolean | number | string
paddingInlineStart
boolean | number | string
paddingInlineEnd
boolean | number | string
paddingBlockStart
boolean | number | string
paddingBlockEnd
boolean | number | string
rounded
boolean | number | string | TRounded | null | undefined
roundedTopRight
boolean | number | string
roundedTopLeft
boolean | number | string
roundedBottomLeft
boolean | number | string
roundedBottomRight
boolean | number | string
roundedStartStart
boolean | number | string
roundedStartEnd
boolean | number | string
roundedEndStart
boolean | number | string
roundedEndEnd
boolean | number | string
fontSize
TFontSize
fontWeight
TFontWeight
lineHeight
TLineHeight
letterSpacing
TLetterSpacing
active
boolean | IStateEffectConfig
activeClass
string
variant
TVariantInput
elevation
TElevation
size
TSize | number
hideDetails
boolean | string
hideSpinButtons
boolean
hint
string
Helper text below the field.
persistentHint
boolean
false
Always shows the hint (not just on focus).
messages
Array<string> | string
height
number | string
maxHeight
number | string
maxWidth
number | string
minHeight
number | string
minWidth
number | string
width
number | string
direction
TDirection
errorMessages
Array<string> | string
Validation error messages shown below the field in error state.
maxErrors
number | string
readonly
boolean
false
Makes the textarea non-editable.
rules
Array<any>
modelValue
any
Current textarea value. Synced via v-model.
validateOn
TValidateOn
validationValue
any
appendAvatar
string
appendIcon
TIcon
prependAvatar
string
prependIcon
TIcon
prependAriaLabel
string
appendAriaLabel
string

API

Slots

Emplacements de contenu exposés par ce composant.

#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

Événements émis par ce composant.

@update:height
number
Emitted when the textarea height changes in autoGrow mode.
@click:control
MouseEvent
Fired when the user clicks the textarea control area.
@mousedown:control
MouseEvent
Fired on mousedown on the control area.
@format
TTextareaToolbarCommand, string
Emitted when a rich-text toolbar command is applied (click or keyboard shortcut).
@update:focused
any
@click:appendInner
MouseEvent
@click:prependInner
MouseEvent
@click:clear
MouseEvent
@update:modelValue
any
Emitted on every input event.
@click:append
MouseEvent
@click:prepend
MouseEvent

API

Membres exposés

Propriétés et méthodes accessibles via ref template (defineExpose). Utilisés pour le contrôle programmatique.

<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.

Personnalisation

Variables CSS

Propriétés CSS personnalisées exposées par ce composant. Surchargez-les pour personnaliser sans perdre la compatibilité avec le thème.

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

Accessibilité

Rôles ARIA, navigation clavier et gestion du focus. Sourcé depuis le template réel du composant.

Rôles ARIA

textbox

Interactions clavier

Interactions clavier
ToucheAction
TabFocuses the textarea.
Shift+TabMoves 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.

Fondation

Design tokens

Extrait des tokens de ce composant — les variables --origam-<composant>---<propriété>, déclarées dans sa feuille de tokens tenue à la main, sans étape de build.

Source
number
var(--origam-opacity---0)
Initial textarea opacity (revealed on mount).
duration
0.15s
Fade-in duration.
color
var(--origam-color__border---subtle)
Resize grip border color.
color
var(--origam-color__surface---sunken)
Rich toolbar background.
dimension
var(--origam-radius---md)
Rich toolbar border radius.

Interactif

Playground

Modifiez les props en direct et observez le composant se mettre à jour. Le snippet de code généré suit vos changements.

Rendu de l’aperçu en cours…

Usage

Exemples

Extraits de code prêts à coller dans vos templates.

Basic textarea

vue

Auto-grow

vue

Rich text mode

vue

Écosystème

Famille

Composants du même dossier qui partagent les conventions et se composent souvent ensemble.