RichToolbar
Rich-text formatting toolbar with configurable command buttons (bold, italic, underline, link, lists, headings, code). Internal sub-component of OrigamTextareaField.
Structure
Anatomy
Visual breakdown of the component's internal structure with BEM class call-outs.
<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-labellocalised,aria-disabledwhen disabled. Flex wrap layout. - 2.origam-rich-toolbar__btn
<origam-btn variant="text" :icon="true">for each command.aria-pressedtoggles with active state.@mousedown.preventprevents 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
All props accepted by this component, with their type, default value and 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.
- activerequiredITextareaRichActiveState—
- 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.
- disabledbooleanfalse
- Disables all command buttons and sets aria-disabled on the toolbar root.
API
Emits
Events emitted by this component.
- @formatTTextareaToolbarCommand, value?: string
- Fired when a command button is clicked. For the link command, value carries the URL entered in the popover.
API
Exposed members
Properties and methods accessible via template ref (defineExpose). Use them for programmatic control.
- () => Promise<void>
- Programmatically opens the link insertion popover and focuses the URL input.
- () => void
- Closes the link popover and clears the URL input.
Customisation
CSS variables
CSS custom properties exposed by this component. Override them to customise the component without losing theme compatibility.
- 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
Accessibility
ARIA roles, keyboard navigation and focus management. Sourced from the real component template.
ARIA roles
Keyboard interactions
| Key | Action |
|---|---|
| Tab / Shift+Tab | Moves focus through command buttons. Each button is individually focusable. |
| Enter / Space | Activates the focused command button and fires the format event. |
| Enter | Confirms the URL in the link popover input. |
| Escape | Closes 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
Examples
Ready-to-paste code snippets for your templates.
Usage via TextareaField
Custom toolbar via slot
Ecosystem
Family
Components from the same folder that share conventions and often compose together.