Syncfusion Blazor Rich Text Editor
A comprehensive skill for implementing and configuring the Syncfusion Blazor Rich Text Editor (SfRichTextEditor) — a full-featured WYSIWYG editor supporting HTML and Markdown editing, rich toolbar customization, media insertion, tables, data binding, import/export, and accessibility.
When to Use This Skill
Use this skill when the user needs to:
- Install and set up
SfRichTextEditor in a Blazor Server, WebAssembly, or Web App project
- Configure toolbar items, toolbar types (Expand, MultiRow, Scrollable, Popup), or toolbar position
- Format text: bold/italic/underline, headings, lists, alignment, colors, fonts, line height
- Insert and manage images, videos, or audio with upload support
- Work with tables: insert, resize, merge cells, customize quick toolbar
- Switch between HTML, Markdown, or IFrame editor modes
- Enable inline editing (inline toolbar)
- Add custom toolbar tools or use exec commands
- Handle RTE events (
ValueChange, OnActionBegin, image upload events, etc.)
- Bind content two-way with
@bind-Value or retrieve via GetTextAsync
- Configure paste cleanup behavior
- Import from Word / export to Word or PDF
- Implement accessibility, keyboard shortcuts, RTL, or globalization
Quick Start
1. Install NuGet packages:
dotnet add package Syncfusion.Blazor.RichTextEditor
dotnet add package Syncfusion.Blazor.Themes
2. Register in Program.cs:
using Syncfusion.Blazor;
builder.Services.AddSyncfusionBlazor();
3. Add to _Imports.razor:
@using Syncfusion.Blazor
@using Syncfusion.Blazor.RichTextEditor
4. Add CSS/JS in index.html (WASM) or App.razor (Server):
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
5. Add the component:
<SfRichTextEditor @bind-Value="@Content">
<RichTextEditorToolbarSettings Items="@Tools" />
</SfRichTextEditor>
@code {
private string Content { get; set; } = "<p>Start editing...</p>";
private List<ToolbarItemModel> Tools = new()
{
new() { Command = ToolbarCommand.Bold },
new() { Command = ToolbarCommand.Italic },
new() { Command = ToolbarCommand.Underline },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.Formats },
new() { Command = ToolbarCommand.Alignments },
new() { Command = ToolbarCommand.OrderedList },
new() { Command = ToolbarCommand.UnorderedList },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.CreateLink },
new() { Command = ToolbarCommand.Image },
new() { Command = ToolbarCommand.CreateTable },
new() { Command = ToolbarCommand.Separator },
new() { Command = ToolbarCommand.Undo },
new() { Command = ToolbarCommand.Redo }
};
}
Navigation Guide
Getting Started & Setup
📄 Read: references/getting-started.md
- NuGet installation for all project types (Visual Studio, VS Code, .NET CLI)
- Service registration and namespace imports
- CSS theme and JS script references
- Adding the first component to a page
- Retrieving content as HTML, plain text, or character count
Toolbar Configuration
📄 Read: references/toolbar.md
- Enabling or disabling the toolbar with
RichTextEditorToolbarSettings.Enable
- Toolbar types: Expand, MultiRow, Scrollable, Popup
- Floating toolbar and offset configuration
- Toolbar position (top or bottom)
- Configuring toolbar items with
ToolbarItemModel
- Custom toolbar items (template-based)
Built-in Toolbar Tools Reference
📄 Read: references/built-in-tools.md
- Complete list of all
ToolbarCommand enum values
- Text formatting, font & styling, alignment, lists, hyperlinks
- Image/table/link quick toolbar item commands
- Undo/redo, fullscreen, print, source code, preview tools
- Removing or reordering default toolbar items
Text Formatting
📄 Read: references/text-formatting.md
- Bold, italic, underline, strikethrough, subscript, superscript, inline code
- Text alignment (left, center, right, justify)
- Ordered/unordered lists with custom number and bullet styles
- Heading formats (H1–H6, paragraph, blockquote, code)
- Line height configuration
- Horizontal line, format painter, clear format
- Markdown auto-format (inline and block shortcuts)
Images, Video & Audio
📄 Read: references/images-and-media.md
- Image insertion from local machine or URL
RichTextEditorImageSettings: SaveUrl, Path, AllowedTypes, EnableResize
- Base64 vs server-side upload
- Image quick toolbar configuration
- Video and audio insertion and settings
Tables
📄 Read: references/tables.md
- Creating tables with
CreateTable toolbar item
RichTextEditorTableSettings: width, resize, custom styles
- Table quick toolbar: add/remove rows & columns, merge cells, properties
- Advanced table manipulation (cell selection, split, custom borders)
Editor Modes
📄 Read: references/editor-modes.md
- HTML editor mode (default WYSIWYG)
- Markdown editor mode (
EditorMode.Markdown)
- IFrame vs DIV rendering mode
- Source code view toggling
Inline Mode
📄 Read: references/inline-mode.md
- Enabling inline toolbar (
InlineMode)
- Inline toolbar display on text selection
- Use cases: comment editors, in-place content editing
Custom Tools & Exec Commands
📄 Read: references/custom-tools.md
- Adding custom toolbar buttons with
ToolbarItemModel and templates
- Executing commands programmatically with
ExecuteCommandAsync
- Slash commands (
/ trigger menu) configuration
- Format painter advanced settings (
RichTextEditorFormatPainterSettings)
Events
📄 Read: references/events.md
RichTextEditorEvents child component usage and wiring pattern
- Lifecycle events:
Created, Destroyed
- Focus/interaction:
Focus, Blur, OnToolbarClick, SelectionChanged
- Content events:
ValueChange, BeforePasteCleanup, AfterPasteCleanup
- Toolbar lifecycle:
OnActionBegin, OnActionComplete
- Dialog events:
OnDialogOpen, DialogOpened, OnDialogClose, DialogClosed
- Quick toolbar:
OnQuickToolbarOpen, QuickToolbarOpened, QuickToolbarClosed
- Image events:
OnImageSelected, BeforeUploadImage, OnImageUploadSuccess, OnImageUploadFailed, ImageUploadChange, OnImageDrop, ImageDelete
- Media events:
FileSelected, FileUploading, FileUploadSuccess, FileUploadFailed, FileUploadChange, OnMediaDrop, MediaDeleted
- Resize events:
OnResizeStart, OnResizeStop
- Toolbar status:
UpdatedToolbarStatus
- Export events:
OnExport, OnExportFailure
- Slash menu:
SlashMenuItemSelecting
- Complete EventArgs class reference with all properties
Methods
📄 Read: references/methods.md
- Focus & selection:
FocusAsync, FocusOutAsync, SaveSelectionAsync, RestoreSelectionAsync, SelectAllAsync, GetSelectionAsync
- Content retrieval:
GetTextAsync, GetSelectedHtmlAsync, GetCharCountAsync, GetXhtmlAsync
- Command execution: all
ExecuteCommandAsync overloads with typed args (image, link, table, video, audio, code block, format painter)
- Toolbar control:
EnableToolbarItem, DisableToolbarItem, RemoveToolbarItem
- Dialog & UI control:
ShowDialogAsync, CloseDialogAsync, ShowFullScreenAsync, PrintAsync, RefreshUIAsync, ShowSourceCodeAsync
- Undo/redo:
ClearUndoRedoAsync
- Full
CommandName, ToolbarCommand, and DialogType enum references
Properties
📄 Read: references/properties.md
- Content & value:
Value, Placeholder, Readonly, Enabled, MaxLength, ShowCharCount
- Editor behaviour:
EditorMode, EnterKey, ShiftEnterKey, EnableTabKey, EnableAutoUrl, EnableMarkdownAutoFormat, EnableClipboardCleanup, EnableXhtml, EnableHtmlEncode, EnableResize, EnableChunkMessages
- Appearance & layout:
Height, Width, CssClass, ShowTooltip, FloatingToolbarOffset
- Security & sanitization:
EnableHtmlSanitizer, AdditionalSanitizeAttributes, AdditionalSanitizeTags, DeniedSanitizeSelectors
- Keyboard & shortcuts:
KeyConfigure with full ShortcutKeys default bindings table
- Persistence & auto-save:
EnablePersistence, SaveInterval, AutoSaveOnIdle
- Undo/redo config:
UndoRedoSteps, UndoRedoTimer
- HTTP integration:
HttpClientInstance
- Full 37-property summary table
Data Binding & Value Management
📄 Read: references/data-binding.md
- Two-way binding with
@bind-Value
- One-way binding and programmatic value updates
ValueChange event for detecting edits
- Read-only mode (
Readonly property)
- Max length enforcement and character count display
Paste Cleanup
📄 Read: references/paste-and-cleanup.md
RichTextEditorPasteCleanupSettings configuration
- Stripping/keeping specific HTML attributes and styles on paste
- Forcing plain text paste
- Enter key behavior (
EnterKey, ShiftEnterKey)
- Undo/redo manager configuration
Import & Export
📄 Read: references/import-export.md
- Importing Word documents into the editor
- Exporting content to Word (.docx) and PDF
- HTTP client configuration for import/export services
- Mail merge with dynamic data
- WebAssembly performance optimizations for large documents
Accessibility & Globalization
📄 Read: references/accessibility-globalization.md
- WCAG 2.1 compliance details
- Keyboard shortcuts and navigation reference
- ARIA roles and screen reader support
- RTL layout (
EnableRtl)
- Localization and culture configuration
- XHTML validation
Common Patterns
Two-way bound editor with character count
<SfRichTextEditor @bind-Value="@HtmlContent" ShowCharCount="true" MaxLength="2000">
</SfRichTextEditor>
@code {
private string HtmlContent { get; set; } = string.Empty;
}
Read-only display
<SfRichTextEditor Value="@HtmlContent" Readonly="true">
<RichTextEditorToolbarSettings Enable="false" />
</SfRichTextEditor>
Markdown editor mode
<SfRichTextEditor EditorMode="EditorMode.Markdown" @bind-Value="@MarkdownContent">
</SfRichTextEditor>
@code {
private string MarkdownContent { get; set; } = "**Hello** world!";
}
1---
2name: syncfusion-blazor-rich-text-editor
3description: "Implements the Syncfusion Blazor Rich Text Editor (SfRichTextEditor) from Syncfusion.Blazor.RichTextEditor. Supports HTML, Markdown, and IFrame editor modes. Use this skills for toolbar configuration, image/video/audio insertion, table management, paste cleanup, import/export Word/PDF, accessibility, globalization, RTL, and inline or custom toolbar tool scenarios in Blazor applications."
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "File Viewers & Editors"
8---
9
10# Syncfusion Blazor Rich Text Editor
11
12A comprehensive skill for implementing and configuring the **Syncfusion Blazor Rich Text Editor** (`SfRichTextEditor`) — a full-featured WYSIWYG editor supporting HTML and Markdown editing, rich toolbar customization, media insertion, tables, data binding, import/export, and accessibility.
13
14## When to Use This Skill
15
16Use this skill when the user needs to:
17- Install and set up `SfRichTextEditor` in a Blazor Server, WebAssembly, or Web App project
18- Configure toolbar items, toolbar types (Expand, MultiRow, Scrollable, Popup), or toolbar position
19- Format text: bold/italic/underline, headings, lists, alignment, colors, fonts, line height
20- Insert and manage images, videos, or audio with upload support
21- Work with tables: insert, resize, merge cells, customize quick toolbar
22- Switch between HTML, Markdown, or IFrame editor modes
23- Enable inline editing (inline toolbar)
24- Add custom toolbar tools or use exec commands
25- Handle RTE events (`ValueChange`, `OnActionBegin`, image upload events, etc.)
26- Bind content two-way with `@bind-Value` or retrieve via `GetTextAsync`
27- Configure paste cleanup behavior
28- Import from Word / export to Word or PDF
29- Implement accessibility, keyboard shortcuts, RTL, or globalization
30
31## Quick Start
32
33**1. Install NuGet packages:**
34```bash
35dotnet add package Syncfusion.Blazor.RichTextEditor
36dotnet add package Syncfusion.Blazor.Themes
37```
38
39**2. Register in `Program.cs`:**
40```csharp
41using Syncfusion.Blazor;
42builder.Services.AddSyncfusionBlazor();
43```
44
45**3. Add to `_Imports.razor`:**
46```razor
47@using Syncfusion.Blazor
48@using Syncfusion.Blazor.RichTextEditor
49```
50
51**4. Add CSS/JS in `index.html` (WASM) or `App.razor` (Server):**
52```html
53<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
54<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
55```
56
57**5. Add the component:**
58```razor
59<SfRichTextEditor @bind-Value="@Content">
60 <RichTextEditorToolbarSettings Items="@Tools" />
61</SfRichTextEditor>
62
63@code {
64 private string Content { get; set; } = "<p>Start editing...</p>";
65
66 private List<ToolbarItemModel> Tools = new()
67 {
68 new() { Command = ToolbarCommand.Bold },
69 new() { Command = ToolbarCommand.Italic },
70 new() { Command = ToolbarCommand.Underline },
71 new() { Command = ToolbarCommand.Separator },
72 new() { Command = ToolbarCommand.Formats },
73 new() { Command = ToolbarCommand.Alignments },
74 new() { Command = ToolbarCommand.OrderedList },
75 new() { Command = ToolbarCommand.UnorderedList },
76 new() { Command = ToolbarCommand.Separator },
77 new() { Command = ToolbarCommand.CreateLink },
78 new() { Command = ToolbarCommand.Image },
79 new() { Command = ToolbarCommand.CreateTable },
80 new() { Command = ToolbarCommand.Separator },
81 new() { Command = ToolbarCommand.Undo },
82 new() { Command = ToolbarCommand.Redo }
83 };
84}
85```
86
87## Navigation Guide
88
89### Getting Started & Setup
90📄 **Read:** [references/getting-started.md](references/getting-started.md)
91- NuGet installation for all project types (Visual Studio, VS Code, .NET CLI)
92- Service registration and namespace imports
93- CSS theme and JS script references
94- Adding the first component to a page
95- Retrieving content as HTML, plain text, or character count
96
97### Toolbar Configuration
98📄 **Read:** [references/toolbar.md](references/toolbar.md)
99- Enabling or disabling the toolbar with `RichTextEditorToolbarSettings.Enable`
100- Toolbar types: Expand, MultiRow, Scrollable, Popup
101- Floating toolbar and offset configuration
102- Toolbar position (top or bottom)
103- Configuring toolbar items with `ToolbarItemModel`
104- Custom toolbar items (template-based)
105
106### Built-in Toolbar Tools Reference
107📄 **Read:** [references/built-in-tools.md](references/built-in-tools.md)
108- Complete list of all `ToolbarCommand` enum values
109- Text formatting, font & styling, alignment, lists, hyperlinks
110- Image/table/link quick toolbar item commands
111- Undo/redo, fullscreen, print, source code, preview tools
112- Removing or reordering default toolbar items
113
114### Text Formatting
115📄 **Read:** [references/text-formatting.md](references/text-formatting.md)
116- Bold, italic, underline, strikethrough, subscript, superscript, inline code
117- Text alignment (left, center, right, justify)
118- Ordered/unordered lists with custom number and bullet styles
119- Heading formats (H1–H6, paragraph, blockquote, code)
120- Line height configuration
121- Horizontal line, format painter, clear format
122- Markdown auto-format (inline and block shortcuts)
123
124### Images, Video & Audio
125📄 **Read:** [references/images-and-media.md](references/images-and-media.md)
126- Image insertion from local machine or URL
127- `RichTextEditorImageSettings`: SaveUrl, Path, AllowedTypes, EnableResize
128- Base64 vs server-side upload
129- Image quick toolbar configuration
130- Video and audio insertion and settings
131
132### Tables
133📄 **Read:** [references/tables.md](references/tables.md)
134- Creating tables with `CreateTable` toolbar item
135- `RichTextEditorTableSettings`: width, resize, custom styles
136- Table quick toolbar: add/remove rows & columns, merge cells, properties
137- Advanced table manipulation (cell selection, split, custom borders)
138
139### Editor Modes
140📄 **Read:** [references/editor-modes.md](references/editor-modes.md)
141- HTML editor mode (default WYSIWYG)
142- Markdown editor mode (`EditorMode.Markdown`)
143- IFrame vs DIV rendering mode
144- Source code view toggling
145
146### Inline Mode
147📄 **Read:** [references/inline-mode.md](references/inline-mode.md)
148- Enabling inline toolbar (`InlineMode`)
149- Inline toolbar display on text selection
150- Use cases: comment editors, in-place content editing
151
152### Custom Tools & Exec Commands
153📄 **Read:** [references/custom-tools.md](references/custom-tools.md)
154- Adding custom toolbar buttons with `ToolbarItemModel` and templates
155- Executing commands programmatically with `ExecuteCommandAsync`
156- Slash commands (`/` trigger menu) configuration
157- Format painter advanced settings (`RichTextEditorFormatPainterSettings`)
158
159### Events
160📄 **Read:** [references/events.md](references/events.md)
161- `RichTextEditorEvents` child component usage and wiring pattern
162- Lifecycle events: `Created`, `Destroyed`
163- Focus/interaction: `Focus`, `Blur`, `OnToolbarClick`, `SelectionChanged`
164- Content events: `ValueChange`, `BeforePasteCleanup`, `AfterPasteCleanup`
165- Toolbar lifecycle: `OnActionBegin`, `OnActionComplete`
166- Dialog events: `OnDialogOpen`, `DialogOpened`, `OnDialogClose`, `DialogClosed`
167- Quick toolbar: `OnQuickToolbarOpen`, `QuickToolbarOpened`, `QuickToolbarClosed`
168- Image events: `OnImageSelected`, `BeforeUploadImage`, `OnImageUploadSuccess`, `OnImageUploadFailed`, `ImageUploadChange`, `OnImageDrop`, `ImageDelete`
169- Media events: `FileSelected`, `FileUploading`, `FileUploadSuccess`, `FileUploadFailed`, `FileUploadChange`, `OnMediaDrop`, `MediaDeleted`
170- Resize events: `OnResizeStart`, `OnResizeStop`
171- Toolbar status: `UpdatedToolbarStatus`
172- Export events: `OnExport`, `OnExportFailure`
173- Slash menu: `SlashMenuItemSelecting`
174- Complete EventArgs class reference with all properties
175
176### Methods
177📄 **Read:** [references/methods.md](references/methods.md)
178- Focus & selection: `FocusAsync`, `FocusOutAsync`, `SaveSelectionAsync`, `RestoreSelectionAsync`, `SelectAllAsync`, `GetSelectionAsync`
179- Content retrieval: `GetTextAsync`, `GetSelectedHtmlAsync`, `GetCharCountAsync`, `GetXhtmlAsync`
180- Command execution: all `ExecuteCommandAsync` overloads with typed args (image, link, table, video, audio, code block, format painter)
181- Toolbar control: `EnableToolbarItem`, `DisableToolbarItem`, `RemoveToolbarItem`
182- Dialog & UI control: `ShowDialogAsync`, `CloseDialogAsync`, `ShowFullScreenAsync`, `PrintAsync`, `RefreshUIAsync`, `ShowSourceCodeAsync`
183- Undo/redo: `ClearUndoRedoAsync`
184- Full `CommandName`, `ToolbarCommand`, and `DialogType` enum references
185
186### Properties
187📄 **Read:** [references/properties.md](references/properties.md)
188- Content & value: `Value`, `Placeholder`, `Readonly`, `Enabled`, `MaxLength`, `ShowCharCount`
189- Editor behaviour: `EditorMode`, `EnterKey`, `ShiftEnterKey`, `EnableTabKey`, `EnableAutoUrl`, `EnableMarkdownAutoFormat`, `EnableClipboardCleanup`, `EnableXhtml`, `EnableHtmlEncode`, `EnableResize`, `EnableChunkMessages`
190- Appearance & layout: `Height`, `Width`, `CssClass`, `ShowTooltip`, `FloatingToolbarOffset`
191- Security & sanitization: `EnableHtmlSanitizer`, `AdditionalSanitizeAttributes`, `AdditionalSanitizeTags`, `DeniedSanitizeSelectors`
192- Keyboard & shortcuts: `KeyConfigure` with full `ShortcutKeys` default bindings table
193- Persistence & auto-save: `EnablePersistence`, `SaveInterval`, `AutoSaveOnIdle`
194- Undo/redo config: `UndoRedoSteps`, `UndoRedoTimer`
195- HTTP integration: `HttpClientInstance`
196- Full 37-property summary table
197
198### Data Binding & Value Management
199📄 **Read:** [references/data-binding.md](references/data-binding.md)
200- Two-way binding with `@bind-Value`
201- One-way binding and programmatic value updates
202- `ValueChange` event for detecting edits
203- Read-only mode (`Readonly` property)
204- Max length enforcement and character count display
205
206### Paste Cleanup
207📄 **Read:** [references/paste-and-cleanup.md](references/paste-and-cleanup.md)
208- `RichTextEditorPasteCleanupSettings` configuration
209- Stripping/keeping specific HTML attributes and styles on paste
210- Forcing plain text paste
211- Enter key behavior (`EnterKey`, `ShiftEnterKey`)
212- Undo/redo manager configuration
213
214### Import & Export
215📄 **Read:** [references/import-export.md](references/import-export.md)
216- Importing Word documents into the editor
217- Exporting content to Word (.docx) and PDF
218- HTTP client configuration for import/export services
219- Mail merge with dynamic data
220- WebAssembly performance optimizations for large documents
221
222### Accessibility & Globalization
223📄 **Read:** [references/accessibility-globalization.md](references/accessibility-globalization.md)
224- WCAG 2.1 compliance details
225- Keyboard shortcuts and navigation reference
226- ARIA roles and screen reader support
227- RTL layout (`EnableRtl`)
228- Localization and culture configuration
229- XHTML validation
230
231## Common Patterns
232
233### Two-way bound editor with character count
234```razor
235<SfRichTextEditor @bind-Value="@HtmlContent" ShowCharCount="true" MaxLength="2000">
236</SfRichTextEditor>
237
238@code {
239 private string HtmlContent { get; set; } = string.Empty;
240}
241```
242
243### Read-only display
244```razor
245<SfRichTextEditor Value="@HtmlContent" Readonly="true">
246 <RichTextEditorToolbarSettings Enable="false" />
247</SfRichTextEditor>
248```
249
250### Markdown editor mode
251```razor
252<SfRichTextEditor EditorMode="EditorMode.Markdown" @bind-Value="@MarkdownContent">
253</SfRichTextEditor>
254
255@code {
256 private string MarkdownContent { get; set; } = "**Hello** world!";
257}
258```