Rich Text Editor
Rich text editor provides a WYSIWYG editing surface for formatted text, and a read-only renderer for displaying it.
Overview
The rich text editor lets users write and format text, such as notes, comments and descriptions, with headings, lists, emphasis and links. It’s built on Tiptap and comes with a read-only renderer for displaying the saved content elsewhere in an app.
It ships in its own package, @tylertech/forge-rich-text-editor, so apps that don’t need it don’t pay for Tiptap. It usually sits in a form alongside text fields, or in a card or dialog where users add a comment.
Usage
forge-rich-text-editor only supports the formatting of the feature elements slotted into it. Slot forge-rte-standard-tools for headings, bold, italic, underline, strikethrough, lists, alignment and undo, and add forge-rte-code and forge-rte-link when you need them. Read the content with toJSON() or the change event, and display it with forge-rich-text-renderer. For plain text, or a single line, use a text field instead.
Rules
Basic usage
Slot forge-rte-standard-tools into the editor. An editor with nothing slotted keeps text but supports no formatting.
A rich text editor with the standard formatting tools.
<forge-rich-text-editor>
<forge-rte-standard-tools>
</forge-rte-standard-tools>
</forge-rich-text-editor>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Composed toolbar
To place the toolbar apart from the content, for a fixed toolbar or a custom layout, wrap them in forge-rich-text-context instead of using forge-rich-text-editor. Put the tools in a forge-rich-text-toolbar, which gives them the toolbar role, an accessible name from its label, and a single tab stop, and add a forge-rich-text-content for the editing area. forge-rich-text-context takes the same properties and events as the editor.
A toolbar and content area laid out separately inside forge-rich-text-context.
<forge-rich-text-context>
<div class="flex flex-col gap-medium">
<forge-rich-text-toolbar label="Formatting" class="p-small rounded-lg border border-outline bg-surface-container-low">
<forge-rte-standard-tools>
</forge-rte-standard-tools>
<forge-rte-divider>
</forge-rte-divider>
<forge-rte-code>
</forge-rte-code>
<forge-rte-link>
</forge-rte-link>
</forge-rich-text-toolbar>
<div class="min-h-[200px] rounded-lg border border-outline bg-surface">
<forge-rich-text-content>
</forge-rich-text-content>
</div>
</div>
</forge-rich-text-context>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Output formats
toJSON() returns the ProseMirror document, the same value the change event emits. Store it to save the content without a round trip through HTML. toHTML() returns sanitized HTML, and toMarkdown() returns Markdown.
The content property accepts either an HTML string or a document; the content attribute only accepts HTML. Documents are stricter: one mark the editor has no feature for discards the whole document, while HTML just loses that formatting. The editor reports a discarded document through its error event, with context: 'Invalid document content'. Load a document into an editor with the same features as the one that saved it.
The editor's content as a ProseMirror document, HTML and Markdown, updating as you type.
<div class="flex flex-col gap-medium">
<forge-rich-text-editor
id="output-formats-editor"
content="<h2>
Sample document
</h2>
<p>
A paragraph with
<strong>
bold
</strong>
and
<em>
italic
</em>
text.
</p>
<ul>
<li>
<p>
Bullet item one
</p>
</li>
<li>
<p>
Bullet item two
</p>
</li>
</ul>
">
<forge-rte-standard-tools>
</forge-rte-standard-tools>
</forge-rich-text-editor>
<div class="grid grid-cols-1 md:grid-cols-3 gap-medium">
<section class="flex flex-col gap-xsmall min-w-0">
<h2 class="forge-typography--label2">
toJSON()
</h2>
<pre
id="output-formats-json"
class="m-0 p-small max-h-[300px] overflow-auto rounded-lg border border-outline bg-surface-container-low font-mono text-xs whitespace-pre-wrap break-words">
</pre>
</section>
<section class="flex flex-col gap-xsmall min-w-0">
<h2 class="forge-typography--label2">
toHTML()
</h2>
<pre
id="output-formats-html"
class="m-0 p-small max-h-[300px] overflow-auto rounded-lg border border-outline bg-surface-container-low font-mono text-xs whitespace-pre-wrap break-words">
</pre>
</section>
<section class="flex flex-col gap-xsmall min-w-0">
<h2 class="forge-typography--label2">
toMarkdown()
</h2>
<pre
id="output-formats-markdown"
class="m-0 p-small max-h-[300px] overflow-auto rounded-lg border border-outline bg-surface-container-low font-mono text-xs whitespace-pre-wrap break-words">
</pre>
</section>
</div>
</div>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
const editor = document.getElementById("output-formats-editor");
const jsonOutput = document.getElementById("output-formats-json");
const htmlOutput = document.getElementById("output-formats-html");
const markdownOutput = document.getElementById("output-formats-markdown");
const showOutputs = () => {
jsonOutput.textContent = JSON.stringify(editor.toJSON(), null, 2);
htmlOutput.textContent = editor.toHTML();
markdownOutput.textContent = editor.toMarkdown();
};
editor.addEventListener("initialized", showOutputs);
editor.addEventListener("change", showOutputs);
</script>Renderer
forge-rich-text-renderer displays saved content read-only, with no toolbar. Its content property only takes a ProseMirror document. To display HTML, convert it first with toRichTextDocument(html).
Saved content displayed read-only with forge-rich-text-renderer.
<forge-rich-text-renderer id="renderer-demo" aria-label="Sample document">
</forge-rich-text-renderer>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import { RICH_TEXT_STANDARD_FEATURES, toRichTextDocument } from "@tylertech/forge-rich-text-editor";
const savedDocument = toRichTextDocument(
`<h2>Release notes</h2>
<p>This content is displayed read-only through <code>forge-rich-text-renderer</code>.</p>
<ul>
<li><p>Displays saved content without a toolbar</p></li>
<li><p>Keeps the formatting and structure of the document</p></li>
</ul>
<p><em>Use it for comments, notes and any other content users read but don't edit.</em></p>`,
[...RICH_TEXT_STANDARD_FEATURES, "code"]
);
const renderer = document.getElementById("renderer-demo");
renderer.content = savedDocument;
</script>The renderer has role="article" unless you set another role. Give it an aria-label or aria-labelledby when there’s more than one on the page.
Links
forge-rte-link adds a link tool that opens a popover for the URL. Dangerous protocols such as javascript: are always rejected, in typed and pasted links. With auto-protocol, a URL with no protocol gets https://. Links open in a new tab with rel="noopener noreferrer nofollow".
An editor with the link tool. Select text, then use the link button to add a URL.
<forge-rich-text-editor
content='<p>
Select some text, then use the link button. Enter
<code>
example.com
</code>
to see the protocol added, or visit the
<a href="https://tylerforge.design">
Forge docs
</a>
.
</p>
'>
<forge-rte-standard-tools>
</forge-rte-standard-tools>
<forge-rte-divider>
</forge-rte-divider>
<forge-rte-code>
</forge-rte-code>
<forge-rte-link auto-protocol>
</forge-rte-link>
</forge-rich-text-editor>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Character limits
max-length limits the number of characters, and each block boundary, like a new paragraph, counts as one. Typing and pasting stop at the limit, and a paste that would go over it is refused rather than cut short. show-character-count and show-word-count add counters below the editor.
Content set through content loads even when it’s over the limit. The editor then shows error-message and reports { isValid, errors } through its validation event, which you can use to block a form submission.
An editor with a 500 character limit and character and word counts.
<forge-rich-text-editor
max-length="500"
show-character-count
show-word-count
error-message="Content exceeds the maximum length of 500 characters"
content="<p>
Start typing to watch the character and word counts update.
</p>
">
<forge-rte-standard-tools>
</forge-rte-standard-tools>
</forge-rich-text-editor>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Disabled
disabled dims the whole editor, and the content can’t be edited or selected.
A disabled rich text editor.
<forge-rich-text-editor
disabled
content="<p>
This editor is
<strong>
disabled
</strong>
. The content can't be edited or selected, and every toolbar button is disabled.
</p>
">
<forge-rte-standard-tools>
</forge-rte-standard-tools>
</forge-rich-text-editor>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Read-only
readonly keeps the content selectable and copyable, and only dims the toolbar. Use it for content users may need to read or quote. In a composed layout, --forge-rich-text-toolbar-readonly-opacity sets how much forge-rich-text-toolbar is dimmed.
A read-only rich text editor.
<forge-rich-text-editor readonly content="<p>
This editor is
<strong>
read-only
</strong>
. You can select and copy the text, but you can't change it.
</p>
">
<forge-rte-standard-tools>
</forge-rte-standard-tools>
</forge-rich-text-editor>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
</script>Form integration
The editor isn’t a native form control, so it isn’t included in FormData and a form reset doesn’t clear it. Read its value on submit with toJSON() or toHTML(), and clear it on reset by setting content to an empty string. See Forms for validation patterns.
A form that reads the editor's content on submit and clears it on reset.
<form id="form-integration-form" class="flex flex-col gap-medium max-w-[800px]">
<forge-text-field>
<label slot="label" for="form-integration-title">
Document title
</label>
<input type="text" id="form-integration-title" name="title" required />
</forge-text-field>
<div class="flex flex-col gap-xsmall">
<span class="forge-typography--label2">
Content
</span>
<forge-rich-text-editor id="form-integration-editor" max-length="1000" show-character-count>
<forge-rte-standard-tools>
</forge-rte-standard-tools>
<forge-rte-divider>
</forge-rte-divider>
<forge-rte-code>
</forge-rte-code>
<forge-rte-link>
</forge-rte-link>
</forge-rich-text-editor>
</div>
<div class="flex justify-end gap-small">
<forge-button type="reset" variant="outlined">
Reset
</forge-button>
<forge-button type="submit" variant="raised">
Submit
</forge-button>
</div>
<pre
id="form-integration-output"
class="m-0 p-small rounded-lg border border-outline bg-surface-container-low font-mono text-xs whitespace-pre-wrap break-words">
Submit to see the extracted values.
</pre
>
</form>
<script type="module">
import "@tylertech/forge-rich-text-editor";
import "@tylertech/forge-rich-text-editor/features";
const form = document.getElementById("form-integration-form");
const editor = document.getElementById("form-integration-editor");
const output = document.getElementById("form-integration-output");
form.addEventListener("submit", (evt) => {
evt.preventDefault();
const title = new FormData(form).get("title");
output.textContent = [`title: ${title}`, `toHTML(): ${editor.toHTML()}`, `toJSON(): ${JSON.stringify(editor.toJSON())}`].join("\n\n");
});
form.addEventListener("reset", () => {
editor.content = "";
output.textContent = "Submit to see the extracted values.";
});
</script>Pasting and sanitization
All content is sanitized before it reaches the editor, whether it’s set through content or pasted. Dangerous elements and on* handlers are removed, and every URL is protocol-checked. The text-align, color and background-color styles are kept, but class and data-* attributes are removed, so formatting that depends on them is lost.
To paste plain text only, set the allowPasteFormatting property to false. It’s a boolean attribute that defaults to on, so set the property rather than the attribute, and set it before the editor initializes: changing it on a live editor has no effect. Users can paste plain text at any time with Ctrl+Shift+V (Cmd+Shift+V on macOS).
const editor = document.createElement('forge-rich-text-editor');
editor.allowPasteFormatting = false;
editor.append(document.createElement('forge-rte-standard-tools'));
container.append(editor);NPM
The rich text editor is in its own package, so apps that don’t use it never load Tiptap. @tylertech/forge is a peer dependency, which your app already has.
npm install @tylertech/forge-rich-text-editor
Registration
The core elements and the feature elements are registered separately, so an app only loads the tools it uses. Import both entry points to register everything:
import '@tylertech/forge-rich-text-editor';
import '@tylertech/forge-rich-text-editor/features';
Or call the define functions:
import { defineRichTextEditorComponents } from '@tylertech/forge-rich-text-editor';
import { defineRteFeatureComponents } from '@tylertech/forge-rich-text-editor/features';
defineRichTextEditorComponents();
defineRteFeatureComponents();
The package root registers forge-rich-text-editor, forge-rich-text-renderer, forge-rich-text-context, forge-rich-text-content and forge-rich-text-toolbar. The /features entry point registers the forge-rte-* tools.
React
npm install @tylertech/forge-rich-text-editor-react @tylertech/forge-rich-text-editor
Importing a component registers its element, so there’s no define call to make:
import { ForgeRichTextEditor, ForgeRteStandardTools } from '@tylertech/forge-rich-text-editor-react';
export const Editor = () => (
<ForgeRichTextEditor maxLength={500} onChange={event => console.log(event.detail)}>
<ForgeRteStandardTools />
</ForgeRichTextEditor>
);
Angular
npm install @tylertech/forge-rich-text-editor-angular @tylertech/forge-rich-text-editor
Import ForgeRteModule for every element, or the individual modules you need. Importing a module registers its element.
import { ForgeRteModule } from '@tylertech/forge-rich-text-editor-angular';
@NgModule({
imports: [ForgeRteModule]
})
export class AppModule {}
<forge-rich-text-editor [maxLength]="500" (change)="onChange($event)">
<forge-rte-standard-tools></forge-rte-standard-tools>
</forge-rich-text-editor>forge-rich-text-editor
A rich text editor component powered by TipTap that provides a flexible, component-based architecture for composing editing features.
import "@tylertech/forge-rich-text-editor";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
content | content | string | '' | The HTML content of the editor. Pass a ProseMirror document through the property instead; an attribute cannot carry an object. |
disabled | disabled | boolean | false | Whether the editor is disabled. |
readOnly | — | boolean | false | Whether the editor is in readonly mode. |
maxLength | max-length | number | 0 | Maximum character length allowed. 0 means no limit. |
errorMessage | error-message | string | '' | Error message to display when validation fails. |
showCharacterCount | show-character-count | boolean | false | Whether to show character count below the editor. |
showWordCount | show-word-count | boolean | false | Whether to show word count below the editor. |
allowPasteFormatting | allow-paste-formatting | boolean | true | Whether to allow pasted content to retain formatting. |
allowPasteImages | allow-paste-images | boolean | false | Whether to allow images to be pasted into the editor. |
isInitialized | — | boolean | — | Returns whether the editor has been successfully initialized. |
initializationError | — | stringnull | — | Returns the initialization error message, if any. |
| — | readonly | boolean | — | Whether the editor is in readonly mode. |
| Name | Detail | Description |
|---|---|---|
change | RichTextEditorChangeEventDetail | Fired when the content of the editor changes. The detail contains the editor content in ProseMirror JSON format. |
validation | RichTextEditorValidationEventDetail | Fired when validation state changes. The detail contains validation status and error messages. |
initialized | void | Fired when the editor has been successfully initialized. |
initialization-error | RichTextEditorInitializationErrorEventDetail | Fired when editor initialization fails. The detail contains the error message. |
error | RichTextEditorErrorEventDetail | Fired when a non-fatal error occurs during editor operation. The detail contains context and error message. A `context` of `Invalid document content` means a ProseMirror document was rejected by the schema and discarded. |
| Name | Description |
|---|---|
(default) | The default slot is reserved for feature components (toolbar buttons like forge-rte-standard-tools, forge-rte-code, forge-rte-link, etc.). |
| Name | Description |
|---|---|
--forge-rich-text-editor-disabled-opacity | The opacity of the editor when it is disabled, and of the toolbar when it is readonly. |
--forge-rich-text-editor-content-padding | The padding around the editable content. |
| Name | Returns | Description |
|---|---|---|
toJSON() | — | Returns the editor content as JSON in ProseMirror format. Returns undefined if the editor is not initialized or if an error occurs. |
toHTML() | — | Returns the editor content as an HTML string. Returns an empty string if the editor is not initialized or if an error occurs. |
toMarkdown() | — | Returns the editor content as a Markdown string. Returns an empty string if the editor is not initialized or if an error occurs. |
forge-rich-text-renderer
Renders rich text content in a read-only format for display purposes.
import "@tylertech/forge-rich-text-editor";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
content | — | RichTextRendererContent | — | The content to render in ProseMirror JSON format. Must be set as a property; it is not settable via attribute. |
| Name | Description |
|---|---|
--forge-rich-text-renderer-padding | The padding around the rendered content. |
forge-rich-text-context
Provides the editor context for composed rich text editor layouts where toolbar and content are separated.
import "@tylertech/forge-rich-text-editor";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
editorId | editor-id | string | 'editor' | The ID of the element to instantiate the editor against. |
content | content | string | '' | The HTML content of the editor. Pass a ProseMirror document through the property instead; an attribute cannot carry an object. |
disabled | disabled | boolean | false | Whether the editor is disabled. |
readOnly | — | boolean | false | Whether the editor is in readonly mode. |
maxLength | max-length | number | 0 | Maximum character length allowed. 0 means no limit. |
errorMessage | error-message | string | '' | Error message to display when validation fails. |
showCharacterCount | show-character-count | boolean | false | Whether to show character count below the editor. |
showWordCount | show-word-count | boolean | false | Whether to show word count below the editor. |
allowPasteFormatting | allow-paste-formatting | boolean | true | Whether to allow pasted content to retain formatting. |
allowPasteImages | allow-paste-images | boolean | false | Whether to allow images to be pasted into the editor. |
editorContext | — | EditorContext | { editor: null, disabled: false, readOnly: false, content: '', isActive(identifier: string | Record<string, unknown>, attributes?: Record<string, unknown>) { return this.editor?.isActive(identifier as any, attributes as any) ?? false; }, isEditable() { return !this.disabled && !this.readOnly && !!this.editor; }, setEditorElement: this.#setEditorElement.bind(this), registerFeature: this.#registerFeature.bind(this), announce: this.#announce.bind(this), controlsElement: null } | Provide the editor context to child components. |
isInitialized | — | boolean | — | Returns whether the editor has been successfully initialized. |
initializationError | — | stringnull | — | Returns the initialization error message, if any. |
| — | readonly | boolean | — | Whether the editor is in readonly mode. |
| Name | Detail | Description |
|---|---|---|
validation | RichTextEditorValidationEventDetail | Fired when validation state changes. The detail contains validation status and error messages. |
change | RichTextEditorChangeEventDetail | Fired when the content of the editor changes. The detail contains the editor content in ProseMirror JSON format. |
initialized | void | Fired when the editor has been successfully initialized. |
initialization-error | RichTextEditorInitializationErrorEventDetail | Fired when editor initialization fails. The detail contains the error message. |
error | RichTextEditorErrorEventDetail | Fired when a non-fatal error occurs during editor operation. The detail contains context and error message. A `context` of `Invalid document content` means a ProseMirror document was rejected by the schema and discarded. |
| Name | Description |
|---|---|
(default) | The default slot for toolbar components and forge-rich-text-content. |
| Name | Returns | Description |
|---|---|---|
toJSON() | objectundefined | Returns the editor content as JSON. Returns undefined if editor is not initialized or if an error occurs. |
toHTML() | string | Returns the editor content as HTML. Returns empty string if editor is not initialized or if an error occurs. The output is sanitized to prevent XSS attacks. |
toMarkdown() | string | Returns the editor content as Markdown. Returns empty string if editor is not initialized or if an error occurs. |
forge-rich-text-content
Renders the editable content area for composed rich text editor layouts.
import "@tylertech/forge-rich-text-editor";| Name | Description |
|---|---|
--forge-rich-text-content-disabled-opacity | The opacity of the content area when the surrounding editor is disabled. |
--forge-rich-text-content-padding | The padding around the editable content. |
forge-rich-text-toolbar
Groups rich text editor tools into an accessible toolbar with a single tab stop.
import "@tylertech/forge-rich-text-editor";| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
label | label | string | 'Rich text formatting toolbar' | The accessible name of the toolbar. |
| Name | Description |
|---|---|
(default) | Feature components, such as `forge-rte-standard-tools`, `forge-rte-link` and `forge-rte-divider`. |
| Name | Description |
|---|---|
--forge-rich-text-toolbar-readonly-opacity | The opacity of the toolbar when the editor is readonly. Falls back to `--forge-rich-text-editor-disabled-opacity`. |
Feature elements
Each feature element adds one tool to the toolbar and the formatting it supports to the editor.
import "@tylertech/forge-rich-text-editor/features";| Element | Attributes | Description |
|---|---|---|
forge-rte-standard-tools | — | A convenience component that bundles common text formatting features into a single toolbar. |
forge-rte-heading | h1-labelh2-labelh3-label | Provides heading formatting buttons (H1, H2, H3) for the rich text editor. |
forge-rte-bold | label | Provides a bold text formatting button for the rich text editor. |
forge-rte-italic | label | Provides an italic text formatting button for the rich text editor. |
forge-rte-underline | label | Provides an underline text formatting button for the rich text editor. |
forge-rte-strike | label | Provides a strikethrough text formatting button for the rich text editor. |
forge-rte-bullet-list | label | Provides a bulleted (unordered) list button for the rich text editor. |
forge-rte-ordered-list | label | Provides a numbered (ordered) list button for the rich text editor. |
forge-rte-align | left-labelcenter-labelright-labeljustify-label | Provides text alignment buttons (left, center, right, justify) for the rich text editor. |
forge-rte-undo-redo | undo-labelredo-label | Provides undo and redo buttons for the rich text editor history management. |
forge-rte-code | label | Provides an inline code formatting button for the rich text editor. |
forge-rte-link | labelauto-protocol | Provides a link creation and editing button for the rich text editor. |
forge-rte-divider | — | A vertical divider for separating groups of buttons in the rich text editor toolbar. |
Keyboard interaction
The toolbar follows the WAI-ARIA toolbar pattern and is a single tab stop. forge-rich-text-editor does this for you. In a composed layout, wrap the tools in forge-rich-text-toolbar to get the same behavior; tools in a plain container are each their own tab stop.
| Key | Action |
|---|---|
| Tab | Moves focus into the toolbar, on the last tool used, then into the content. |
| Right Arrow / Left Arrow | Moves to the next or previous tool, reversed in right-to-left layouts. Focus stops at the first and last tool. |
| Home / End | Moves to the first or last tool. |
| Enter / Space | Activates the focused tool. |
| Enter (link popover) | Applies the link, if the URL is valid. |
| Escape (link popover) | Closes the popover without changing the link. |
Disabled tools are skipped.
Formatting shortcuts
Each shortcut works in the content while the feature that provides it is slotted. Use Cmd in place of Ctrl on macOS.
| Shortcut | Action | Feature |
|---|---|---|
| Ctrl+B | Bold | forge-rte-bold |
| Ctrl+I | Italic | forge-rte-italic |
| Ctrl+U | Underline | forge-rte-underline |
| Ctrl+Shift+S | Strikethrough | forge-rte-strike |
| Ctrl+E | Inline code | forge-rte-code |
| Ctrl+Alt+1 to Ctrl+Alt+3 | Heading 1 to 3 | forge-rte-heading |
| Ctrl+Shift+8 | Bulleted list | forge-rte-bullet-list |
| Ctrl+Shift+7 | Numbered list | forge-rte-ordered-list |
| Ctrl+Shift+L / E / R / J | Align left, center, right or justify | forge-rte-align |
| Ctrl+Z | Undo | forge-rte-undo-redo |
| Ctrl+Shift+Z or Ctrl+Y | Redo | forge-rte-undo-redo |
| Ctrl+Shift+V | Paste as plain text | Always available |
Screen reader behavior
- The editable area is a multi-line textbox. Tiptap builds its own
contenteditableelement inside the content area, and that inner element is the real control: it receives focus and is where assistive technology lands. Attributes on the outerforge-rich-text-editordon’t reach it. - Formatting tools are toggle buttons that expose their state with
aria-pressedand are disabled with the editor. Undo and redo are plain buttons with no pressed state. Bold, italic, underline, undo and redo also list their shortcut inaria-keyshortcuts. - Applying formatting is announced politely through Forge’s live announcer, for example “Bold applied”, so it isn’t a silent action.
forge-rich-text-rendererhasrole="article"unless you set another role.
Labeling
- The editable area is always named “Rich text editor content”, and there’s currently no way to change that name or point it at your own label. Put a visible label next to the editor so sighted users know what it’s for, and describe its purpose in the surrounding content.
- In a composed layout, give
forge-rich-text-toolbaralabelso the toolbar has an accessible name. - Give each
forge-rich-text-rendereranaria-labeloraria-labelledbywhen there’s more than one on a page. - Every tool has a default label, which you can change for localization:
labelon most tools,h1-labeltoh3-labelonforge-rte-heading,left-labeltojustify-labelonforge-rte-align, andundo-labelandredo-labelonforge-rte-undo-redo.
Disabled and read-only
Both states stop editing and disable the tools. disabled also dims the content and blocks selecting it, and the content area reports aria-disabled. readonly leaves the content at full contrast and selectable, so users can still read and copy it, and reports aria-readonly. Prefer readonly for content users need to read.