TextareaField
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.
<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.
- 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
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: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
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
Interactions clavier
| Touche | 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.
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.
- 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.
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
Auto-grow
Rich text mode
Écosystème
Famille
Composants du même dossier qui partagent les conventions et se composent souvent ensemble.