Forms Form-associated
Editor <pm-editor>
Rich-text editor for short formatted content: comments, descriptions, notes. Form-associated; submits clean HTML.
States
Each state is one attribute.
DisabledRead-onlyRequiredErrorOverview
Supports bold, italic, underline, headings, lists, quotes, code and links, with the usual keyboard shortcuts. Pasted and assigned content is reduced to those tags, so the value never contains scripts, styles or unknown markup. Sanitise again on the server before storing or showing it: the browser is not a trust boundary.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
label | string | — | Visible label (required for accessibility). |
value | string | — | Initial HTML. |
placeholder | string | — | Shown while empty. |
hint | string | — | Help text under the editor. |
error | string | — | Custom error message. Setting it marks the field invalid. |
required | boolean | — | The form cannot be submitted while the editor is empty. |
disabled | boolean | — | Not editable and not submitted. |
readonly | boolean | — | Not editable, still submitted. |
toolbar | string | — | Tools to show, space-separated, with | for a divider: bold italic underline strike h2 h3 bullet number quote code link clear undo redo. |
maxlength | number | — | Longest allowed text, in characters. |
name | string | — | Form field name. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-input | onPmInput | The content changed. |
pm-change | onPmChange | The content changed and the editor lost focus. |
Methods
checkValidity(), reportValidity(), focus()