z-rteRich Text Editor
TipTap-based rich text editor with a configurable grouped toolbar, word counter, and HTML value submission.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
toolbar | string | '' | Custom toolbar as grouped JSON arrays, e.g. [["bold","italic"],["list"]]. Items: bold, italic, underline, strikethrough, list, list-ordered, h1–h6, align-left/center/right/justify, blockquote (aliases like strike and bullet-list are accepted). |
readonly | boolean | false | Makes the editor non-editable while keeping the toolbar visible. |
Inherited from InputMixin
| Attribute | Type | Default | Description |
|---|---|---|---|
disabled | boolean | false | Disables the control so it cannot be interacted with. |
form | string | '' | Associates the hidden form input with a form by id, even when the component sits outside that form. |
name | string | '' | Field name for the hidden form input; array values submit as name[]. |
placeholder | string | '' | Placeholder text for the control's empty state. |
required | boolean | false | Marks the control as required. |
value | string | '' | Initial value of the control, synchronized with the hidden form input. |
Inherited from Hwc
| Attribute | Type | Default | Description |
|---|---|---|---|
i18n | string | '' | Per-instance text overrides as key: text pairs, merged over the global z-i18n script and the built-in defaults. |
floating | string | '' | Floating UI placement options (for example offset and shiftPadding) parsed as key: value pairs. |
force-prevent-rerender | boolean | false | Skips re-rendering after the first render; an existing data-host-inner child is adopted as the rendered DOM. |
template | string | '' | Selector or id of an external element or <template> whose inner content is cloned in place of an inline template[data-fn="template"] child. |
Inherited from Base
| Attribute | Type | Default | Description |
|---|---|---|---|
cls | string | '' | Adds classes to named parts as key: classes pairs; a plain string targets the default part. |
stl | string | '' | Adds inline styles to named parts as key: styles pairs; a plain string targets the default part. |
Custom Styling (cls / stl)
Default cls target:host-inner · defaultstl target:host-inner
| Key | Default class | cls | stl | Description |
|---|---|---|---|---|
body | z-rte-body | yes | yes | Editor body wrapper (default z-rte-body). |
button | z-button z-button-default z-button-icon z-button-xsmall | yes | yes | Toolbar button (default z-button z-button-default z-button-icon z-button-xsmall). |
editor | — | yes | yes | The editable content region. |
footer | z-rte-footer | yes | yes | Footer region with the word counter (default z-rte-footer). |
header | z-rte-header | yes | yes | Header region above the toolbar. |
host-inner | z-rte | yes | yes | Editor root (default z-rte); the default cls/stl target. |
toolbar | z-rte-toolbar | yes | yes | The toolbar (default z-rte-toolbar). |
toolbar-group | z-rte-toolbar-group | yes | yes | One toolbar button group (default z-rte-toolbar-group). |
i18n Keys
| Key | Default | Placeholders | Description |
|---|---|---|---|
aria-editor | Rich text editor | — | Accessible label of the editable region. |
aria-toolbar | Formatting options | — | Accessible label of the toolbar. Used in: toolbar. |
tooltip-align-center | Align Center | — | Align center button tooltip. |
tooltip-align-justify | Align Justify | — | Align justify button tooltip. |
tooltip-align-left | Align Left | — | Align left button tooltip. |
tooltip-align-right | Align Right | — | Align right button tooltip. |
tooltip-blockquote | Blockquote | — | Blockquote button tooltip. |
tooltip-bold | Bold | — | Bold button tooltip. |
tooltip-h1 | Heading 1 | — | Heading 1 button tooltip. |
tooltip-h2 | Heading 2 | — | Heading 2 button tooltip. |
tooltip-h3 | Heading 3 | — | Heading 3 button tooltip. |
tooltip-h4 | Heading 4 | — | Heading 4 button tooltip. |
tooltip-h5 | Heading 5 | — | Heading 5 button tooltip. |
tooltip-h6 | Heading 6 | — | Heading 6 button tooltip. |
tooltip-italic | Italic | — | Italic button tooltip. |
tooltip-list | List | — | Bullet list button tooltip. |
tooltip-list-ordered | Ordered List | — | Ordered list button tooltip. |
tooltip-strikethrough | Strikethrough | — | Strikethrough button tooltip. |
tooltip-underline | Underline | — | Underline button tooltip. |
word-counter-plural | words | — | Word counter plural unit. |
word-counter-singular | word | — | Word counter singular unit. |
Events
| Event | Detail | Flags | Description |
|---|---|---|---|
z-rte:input · from InputMixin | { value: string | string[] } | bubbles | Fires when the content changes; detail.value carries the HTML string. |
Data Hooks
| Attribute | Values | Applies to | Role | Description |
|---|---|---|---|---|
data-disabled | — | descendant | marker | Set while the control is disabled. |
data-host-inner · from Hwc | — | descendant | config | Marks the rendered inner wrapper so force-prevent-rerender can adopt server-rendered DOM without re-rendering. |
data-part | body | descendant | marker | Marks the editor body in adopted server-rendered DOM (data-part="body"). |
data-reactive · from Hwc | — | descendant | config | Opts the marked child (config script, data source, icons, or template) into live re-parsing when its DOM mutates. |
data-readonly | — | descendant | marker | Set while the editor is read-only. |
data-tooltip | — | descendant | marker | Tooltip text on toolbar buttons (consumed by the tooltip singleton). |
Child Content
script[data-fn="config"][type="application/json"]
JSON configuration script parsed by the base class (i18n, cls, stl, floating).
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | config | Marks the script as configuration (value: config). |
data-reactive | no | boolean | Re-parses the configuration when the script mutates. |
select[data-fn="data-source"]
Hidden select parsed into grouped option data by the base class.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | data-source | Marks the select as the data source (value: data-source). |
data-reactive | no | boolean | Re-parses the options when the select mutates. |
optgroup · repeatable
Groups options under a label.
| Attribute | Required | Type | Description |
|---|---|---|---|
label | yes | string | Group header text; also the default group key. |
disabled | no | boolean | Disables every option in the group. |
data-key | no | string | Overrides the group key used in the parsed data. |
data-keywords | no | comma-separated string | Comma-separated keywords stored with the group's data. |
option · repeatable
One option entry within the group.
| Attribute | Required | Type | Description |
|---|---|---|---|
value | no | string | Value carried by this option in the parsed data. |
disabled | no | boolean | Makes the option non-selectable. |
selected | no | boolean | Marks the option as initially selected. |
data-keywords | no | comma-separated string | Extra search terms, comma-separated; searched alongside the label and value. |
option · repeatable
One ungrouped option entry.
| Attribute | Required | Type | Description |
|---|---|---|---|
value | no | string | Value carried by this option in the parsed data. |
disabled | no | boolean | Makes the option non-selectable. |
selected | no | boolean | Marks the option as initially selected. |
data-keywords | no | comma-separated string | Extra search terms, comma-separated. |
template[data-fn="icons"]
Instance-level icon repository.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | icons | Marks the template as an icon source (value: icons). |
data-reactive | no | boolean | Re-parses the icons when the template mutates. |
* · repeatable
One icon element.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-key | yes | string | Icon key referenced by $icons. |
template[data-fn="template"]
Deferred content template mounted by the base class.
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | template | Marks the template for deferred mounting (value: template). |
data-reactive | no | boolean | Re-parses the template when it mutates. |
template[data-fn="value"]
Initial HTML content template (<template data-fn="value">).
| Attribute | Required | Type | Description |
|---|---|---|---|
data-fn | yes | value | Marks the template as the initial value (value: value). |
data-reactive | no | boolean | Re-reads the initial content when the template mutates. |
Keyboard
| Keys | Action | When |
|---|---|---|
| Mod+B Mod+I Mod+U | TipTap shortcuts for bold/italic/underline inside the editor. | — |
Accessibility
| Part | ARIA | Description |
|---|---|---|
body | — | Editor body; no static ARIA attributes. |
button | aria-label="${label}" aria-pressed="${isActive ? 'true' : 'false'}" | Toolbar button labeled by its tooltip text, aria-pressed reflects the active mark/node. |
footer | aria-atomic="true" aria-live="polite" | Word counter: aria-live with aria-atomic for polite updates. |
header | — | Header region; no ARIA attributes. |
host-inner | — | Editor root; no static ARIA attributes. |
toolbar | aria-label="${this.getI18nText('aria-toolbar', this.defaultI18n)}" role="toolbar" | Toolbar: role="toolbar" labeled by aria-toolbar. |
toolbar-group | role="group" | Button group: role="group". |
- Toolbar buttons expose their state with
aria-pressed; the word counter updates politely. - The HTML value submits through the hidden form input.