BlazorRTE 1.2.1
dotnet add package BlazorRTE --version 1.2.1
NuGet\Install-Package BlazorRTE -Version 1.2.1
<PackageReference Include="BlazorRTE" Version="1.2.1" />
<PackageVersion Include="BlazorRTE" Version="1.2.1" />
<PackageReference Include="BlazorRTE" />
paket add BlazorRTE --version 1.2.1
#r "nuget: BlazorRTE, 1.2.1"
#:package BlazorRTE@1.2.1
#addin nuget:?package=BlazorRTE&version=1.2.1
#tool nuget:?package=BlazorRTE&version=1.2.1
BlazorRTE - Rich Text Editor for Blazor
Native Blazor β’ Keyboard Accessible β’ Zero External Dependencies
π Browser Support
| Browser | Status |
|---|---|
| Chrome | β Tested |
| Edge | β Tested |
| Firefox | β Tested |
| Safari | β οΈ Not tested |
π Quick Start
β οΈ Important: BlazorRTE requires interactive rendering.
Installation
dotnet add package BlazorRTE
Basic Usage
@page "/editor"
@using BlazorRTE.Components
@rendermode InteractiveServer
@* Required for JS interop! *@
<RichTextEditor @bind-Value="@content" Placeholder="Start typing..." />
@code { private string content = ""; }
Important: BlazorRTE requires interactive rendering. Add @rendermode InteractiveServer to your page or component.
Why is @rendermode required?
- BlazorRTE uses JavaScript interop for contenteditable functionality
- Static SSR mode won't work - the component needs client-side interactivity
- Supported modes:
InteractiveServer,InteractiveWebAssembly,InteractiveAuto
π― Features
Text Formatting
- β Bold, Italic, Underline, Strikethrough
- β Subscript & Superscript
- β Headings (H1, H2, H3)
- β Bulleted & Numbered Lists
- β Text Alignment (Left, Center, Right, Justify)
- β Indent / Outdent
- β Text & Highlight Colors (preset palette + custom picker)
- β Font Family (10 web-safe fonts)
- β Font Size (6 sizes)
Functionality
- β Links with URL prompts
- β Horizontal Rules
- β Undo/Redo
- β Emoji Picker - 1800+ emojis via BlazorEmo
- β
Emoji Autocomplete - Type
:smilefor suggestions - β Character & Word Count
- β Max length enforcement
- β HTML sanitization (XSS protection)
- β Dark mode support
Accessibility (v1.2.0)
- β Full keyboard navigation for toolbar
- β ARIA labels on all controls
- β Pending format support (click Bold with no selection, then type)
β¨οΈ Keyboard Shortcuts
| Shortcut | Action | Chrome | Edge | Firefox |
|---|---|---|---|---|
Ctrl+B |
Bold | β | β | β |
Ctrl+I |
Italic | β | β | β |
Ctrl+U |
Underline | β | β | β |
Ctrl+Z |
Undo | β | β | β |
Ctrl+Y |
Redo | β | β | β |
Ctrl+Alt+1 |
Heading 1 | β | β | β |
Ctrl+Alt+2 |
Heading 2 | β | β | β |
Ctrl+Alt+3 |
Heading 3 | β | β | β |
Ctrl+L |
Align Left | β | β | β |
Ctrl+Enter |
Horizontal Rule | β | β | β |
Known Issues
- Firefox
Ctrl+Shift+X: Applies strikethrough but also right-aligns text
Toolbar Navigation (v1.2.0)
| Key | Action |
|---|---|
β β |
Move between buttons |
β |
Open dropdown |
Enter / Space |
Activate button |
Escape |
Close dropdown |
Home |
First button |
End |
Last button |
π¬ Chat Mode (Enter to Send)
For chat applications where Enter sends the message:
<RichTextEditor @bind-Value="@message"
BypassEnterKey="true" O
nEnterKeyPressed="SendMessage" />
@code {
private string message = "";
private async Task SendMessage()
{
// Send the message
await SendAsync(message);
message = "";
}
}
BypassEnterKey="true"- Enter triggersOnEnterKeyPressedinstead of newlineShift+Enter- Insert newline when bypass is enabled
π Component Parameters
Component Parameters
[Parameter] public string Value { get; set; }
[Parameter] public EventCallback<string> ValueChanged { get; set; }
[Parameter] public string Placeholder { get; set; } = "Type your message...";
[Parameter] public bool ShowToolbar { get; set; } = true;
[Parameter] public int MaxLength { get; set; } = 5000;
[Parameter] public bool ShowCharacterCount { get; set; } = true;
[Parameter] public string MinHeight { get; set; } = "200px";
[Parameter] public string MaxHeight { get; set; } = "600px";
[Parameter] public bool DarkMode { get; set; } = false;
[Parameter] public bool EnableEmojiShortcodes { get; set; } = true;
[Parameter] public bool BypassEnterKey { get; set; } = false;
[Parameter] public string AriaLabel { get; set; } = "Rich text editor";
Public Methods
await ClearAsync(); // Clear all content
await FocusAsync(); // Focus the editor
string text = GetPlainText(); // Get plain text without HTML
π Emoji Support
BlazorRTE includes two ways to insert emojis:
1. Emoji Picker (Toolbar Button)
Click the π button in the toolbar to open a searchable emoji picker with:
- β 1800+ emojis organized by category
- β Search by name or keyword
- β Recently used emojis (persisted)
- β Full keyboard navigation
- β Smart positioning (viewport-aware)
Keyboard Shortcut: Ctrl+Shift+E
2. Emoji Autocomplete (Inline Shortcodes)
Quick Emoticons (: + 1 character) - Instant replacement:
π β π π¦ β π π β π π β π β€οΈ β β€οΈ π β π
Autocomplete Search (: + 2+ characters) - Shows popup with suggestions:
πmile β π (+ 9 more matches) :heart β β€οΈ (+ 9 more matches) :rocket β π (+ 9 more matches) :thumbs β π (+ 9 more matches)
Autocomplete Features:
- β Appears at cursor position
- β Shows 10 best matches
- β
Keyboard navigation (
ββEnterEsc) - β Click to select
- β Auto-positioning (stays on screen)
- β Fuzzy matching on emoji names and keywords
Note: Emoji data is embedded (no external dependencies). Works offline!
π§ͺ Testing
BlazorRTE includes comprehensive unit tests using bUnit and xUnit.
Test Coverage:
- β 54 Unit Tests covering all major functionality
- β 100% Pass Rate (54/54 tests passing) β
- β Component rendering & initialization
- β Security (XSS prevention, HTML sanitization)
- β UI components (buttons, pickers, toolbar)
- β Event handling and state management
Test Breakdown:
- RichTextEditorTests (41 tests) - Component functionality
- HtmlSanitizerTests (10 tests) - XSS prevention & sanitization
- Additional Tests (3 tests) - Integration & utilities
π Security
BlazorRTE includes enterprise-grade XSS protection:
- β Whitelist-based HTML sanitization
- β
Script tag removal (
<script>, event handlers) - β
Dangerous tag filtering (
<iframe>,<object>,<embed>) - β
JavaScript protocol blocking (
javascript:URLs) - β
Attribute sanitization (removes
onclick,onerror, etc.)
Allowed tags: p, br, strong, em, u, s, h1-h6, ul, ol, li, a, hr, sub, sup, span, font
π License
Community Edition (Free - GPL v3)
- β All 39 features included
- β Free for open-source projects
- β Community support via GitHub Issues
- β οΈ GPL v3 Requirement: Your application must also be open-source under GPL v3
See LICENSE.txt for full GPL v3 terms.
π Acknowledgments
- Heroicons - Beautiful SVG icons (MIT License)
- Material Icons - Link icon (Apache 2.0)
- BlazorEmo - Emoji picker component
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- BlazorEmo (>= 1.0.0)
- Microsoft.AspNetCore.Components.Web (>= 10.0.2)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on BlazorRTE:
| Package | Downloads |
|---|---|
|
BlazorChat
Real-time chat component for Blazor. Context-scoped threads, rich text via BlazorRTE, emoji reactions via BlazorEmo. Community edition β InMemory transport only. Requires BlazorChat.Server (commercial) for production SignalR-backed messaging. |
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.2.1 Bug Fix (2026-02-22)
Fixed:
- Emoji autocomplete popup now highlights the first item on open (was showing last item)
See: https://github.com/simscon1/BlazorRTE/blob/master/Docs/CHANGELOG.md