RichToolbar

Form & Input
stable

Rich-text formatting toolbar with configurable command buttons (bold, italic, underline, link, lists, headings, code). Internal sub-component of OrigamTextareaField.

Structure

Anatomie

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

Anatomy of OrigamRichToolbarSchematic of the RichToolbar component with 5 numbered internal parts. B I U 🔗 ≡ 1 2 3 ① div.origam-rich-toolbar (role="toolbar") ② .origam-rich-toolbar__btn (per item) ③ .origam-rich-toolbar__link-host (link only)
Anatomy of <origam-rich-toolbar> — 3 principal parts: the toolbar root ①, each command button ②, and the link host with popover ③.
1.origam-rich-toolbar
Root element. role="toolbar", aria-label localised, aria-disabled when disabled. Flex wrap layout.
2.origam-rich-toolbar__btn
<origam-btn variant="text" :icon="true"> for each command. aria-pressed toggles with active state. @mousedown.prevent prevents editor blur.
3.origam-rich-toolbar__link-host
Wrapper for the link command. Contains the toggle button and the popover panel.
4.origam-rich-toolbar__link-popover
Absolutely positioned popover with a URL input and an Apply button. Opens when the link button is clicked.
5.origam-rich-toolbar__btn--active
Modifier applied to a command button when the corresponding format is active at the caret position.

API

Props

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

Ordered list of command identifiers to display. Available values: bold, italic, underline, link, list-bullet, list-ordered, heading, heading-1, heading-2, heading-3, code-inline, clear-format.
active
requis
ITextareaRichActiveState
—
Reactive state object describing which commands are currently active at the caret. Shape: { bold, italic, underline, code, link, listBullet, listOrdered, heading: 0|1|2|3 }.
Toolbar placement relative to the editable surface. Values: top, bottom, floating. floating uses position: sticky.
disabled
boolean
false
Disables all command buttons and sets aria-disabled on the toolbar root.

API

Emits

Événements émis par ce composant.

@format
TTextareaToolbarCommand, value?: string
Fired when a command button is clicked. For the link command, value carries the URL entered in the popover.

API

Membres exposés

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

() => Promise<void>
Programmatically opens the link insertion popover and focuses the URL input.
() => void
Closes the link popover and clears the URL input.

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.

Gap between command buttons in the toolbar.
Padding inside the toolbar container.
Background color of the toolbar and link popover.
Border color of the toolbar, input and popover.
Border radius of the toolbar and popover.
Height and min-width of each command button.
Default background of each command button.
Default foreground (icon) color of each command button.
Background color of an active command button.
Foreground color of an active command button.
Focus-visible outline color on each command button.

Inclusion

Accessibilité

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

Rôles ARIA

toolbar

Interactions clavier

Interactions clavier
ToucheAction
Tab / Shift+TabMoves focus through command buttons. Each button is individually focusable.
Enter / SpaceActivates the focused command button and fires the format event.
EnterConfirms the URL in the link popover input.
EscapeCloses the link popover without applying.

Notes

  • The root <div> has role="toolbar" and aria-label (localised via t()). This groups the controls semantically for screen readers.
  • Each command button carries aria-pressed="true|false" reflecting the active state at the caret. Screen readers announce the toggle state.
  • When disabled=true, the toolbar root gets aria-disabled="true" and each button gets the disabled attribute.
  • @mousedown.prevent on every button prevents the contenteditable editor from losing focus when a format button is clicked.
  • The link button carries aria-expanded="true|false" to signal the popover state. The popover input is auto-focused on open (nextTick).

Usage

Exemples

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

Usage via TextareaField

vue

Custom toolbar via slot

vue

Écosystème

Famille

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