BlazorRTE 1.2.1

dotnet add package BlazorRTE --version 1.2.1
                    
NuGet\Install-Package BlazorRTE -Version 1.2.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="BlazorRTE" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="BlazorRTE" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="BlazorRTE" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add BlazorRTE --version 1.2.1
                    
#r "nuget: BlazorRTE, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package BlazorRTE@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=BlazorRTE&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=BlazorRTE&version=1.2.1
                    
Install as a Cake Tool

BlazorRTE - Rich Text Editor for Blazor

Native Blazor β€’ Keyboard Accessible β€’ Zero External Dependencies

License .NET 10

🌐 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 :smile for 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 triggers OnEnterKeyPressed instead of newline
  • Shift+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 (↑ ↓ Enter Esc)
  • βœ… 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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.

Version Downloads Last Updated
1.2.1 49 2/22/2026
1.2.0 48 2/21/2026
1.1.4 57 2/16/2026

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