Blazor RichTextEditor

A dependency-free rich text editor with a grouped Bootstrap toolbar.
API Documentation

Full toolbar #

Start with the complete toolbar when authors need the full RichTextEditor feature set in one place. Keep Disabled set to false so every toolbar action remains available, from document styles and text formatting through media, tables, history, printing, and fullscreen mode.

How to use:
  1. Add RichTextEditor to the page and provide an initial Value.
  2. Omit ToolbarItems to render every supported toolbar control.
  3. Keep Disabled set to false, then use toolbar actions to build a complete document.

Article draft #

Use a focused authoring toolbar to turn a rough release-note draft into structured, scannable content. While Disabled is false, each toolbar action can apply headings, emphasis, color, alignment, lists, and quotations.

How to use:
  1. Choose the commands that match the authoring workflow in ToolbarItems.
  2. Place the caret in a paragraph or select text in the draft.
  3. Use each toolbar action needed for a heading, emphasis, list, alignment, or quotation as the document takes shape.

Publish rich update #

Give a publishing workflow only the insertion commands it needs to add a link, image, separator, or table to an already-authored announcement. This example does not configure ImageUploadHandler, so its Image dialog intentionally shows only the Image URL tab. Keep Disabled set to false while authors use each toolbar action.

How to use:
  1. Configure the insertion-focused commands in ToolbarItems.
  2. Place the caret where the new content belongs in the announcement.
  3. Use the link, image, horizontal-rule, or table toolbar action and complete its dialog when prompted.

Host-controlled image upload #

Configure ImageUploadHandler in the host application instead of configuring a browser endpoint. The Upload image tab is conditional: editors without this callback intentionally show only Image URL. This shared demo supplies the callback, accepts JPEG, PNG, WebP, and GIF files up to 5 MB, returns a trusted temporary HTTPS preview URL, and exposes callback counts so rejected files can be distinguished from host-handler failures. The selectable outcomes also demonstrate cancellation and domain policy rejection.

How to use:
  1. Set ImageUploadHandler, the allowed raster types, size limit, and optional HTTPS domain allow-list.
  2. Open the Image dialog, choose Upload image, and select a valid local raster image.
  3. Review the preview and accessibility options before insertion; use the simulated outcomes to observe host failure, cancellation, and URL-policy feedback.

Disabled #

Use Disabled when rich text should remain visible for review. Editing is disabled: users cannot change the content or invoke a toolbar action.

How to use:
  1. Provide the rich text through Value.
  2. Set Disabled to true when editing is disabled.
  3. Keep the visible content as context; hovering the inactive toolbar explains that editing is disabled, and no toolbar action is available.

Form validation #

Use ValueExpression inside an EditForm to validate the editor's plain-text content while retaining its HTML separately for submission. Keep Disabled set to false while users edit content and use a toolbar action.

How to use:
  1. Add DataAnnotationsValidator and a ValidationMessage for the model property.
  2. Set ValueExpression to the validated model property and update that property from ValueChanged.
  3. Keep editing enabled, then delete the editor content and submit to see required validation feedback before entering content and submitting again.

Events #

Use ValueChanged to react to committed content and show its text metrics in surrounding UI. Keep Disabled set to false while observing edits and toolbar actions. This typing-focused example deliberately reports the callback without assigning its HTML back to the editor value.

How to use:
  1. Handle ValueChanged to receive sanitized HTML, plain text, and count metrics after an edit is committed.
  2. Update external UI such as metrics or a save indicator without writing the callback HTML back into the active editor value.
  3. Edit the text or use a toolbar action, then observe the committed word and character counts.

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please reload the page.