CkEditor5.Blazor
10.48.1
dotnet add package CkEditor5.Blazor --version 10.48.1
NuGet\Install-Package CkEditor5.Blazor -Version 10.48.1
<PackageReference Include="CkEditor5.Blazor" Version="10.48.1" />
<PackageVersion Include="CkEditor5.Blazor" Version="10.48.1" />
<PackageReference Include="CkEditor5.Blazor" />
paket add CkEditor5.Blazor --version 10.48.1
#r "nuget: CkEditor5.Blazor, 10.48.1"
#:package CkEditor5.Blazor@10.48.1
#addin nuget:?package=CkEditor5.Blazor&version=10.48.1
#tool nuget:?package=CkEditor5.Blazor&version=10.48.1
This package, CKEditor5.Blazor, is a Blazor wrapper for CKEditor 5, a rich text editor. It allows seamless integration of CKEditor 5 into Blazor applications, providing various editor variants such as Classic, Inline, Balloon, and Document editors. The package includes necessary configurations and JavaScript interop to facilitate the use of CKEditor 5 within Blazor components.
Installation
Install the package
dotnet add package CkEditor5.Blazor
Add the stylesheet to your App.razor or index.html
<link rel="stylesheet" href="./_content/CkEditor5.Blazor/css/ckeditor5.css" />
Add the premium features stylesheet if you are using premium plugins:
<link rel="stylesheet" href="./_content/CkEditor5.Blazor/css/ckeditor5-premium-features.css" />
Add the source editing code-mirror stylesheet if you are using the SourceEditingCodeMirror plugin:
<link href="./_content/CkEditor5.Blazor/css/ckeditor5-sourceediting-codemirror.css" rel="stylesheet" />
If you aren't using the SourceEditingCodeMirror plugin, do not include the source-editing CodeMirror stylesheet; it will hide the editor's default source view when the plugin is enabled.
Usage
For simple usage without data handling, use the component like this:
<CkEditor />
To handle data changes, use the OnValueChange event handler:
<CkEditor OnValueChanged="HandleChangeMethod" />
You can also set initial data using the Value parameter:
<CkEditor Value="InitialData" OnValueChanged="HandleChangeMethod" />
Alternatively, use a ref on the component to get and set data with the GetData and SetData methods:
<CkEditor @ref="editor" />
@code {
// The editor is a textarea element
private ElementReference editor;
private void HandleChangeMethod(string data)
{
// Handle the data
}
private void SetDataMethod()
{
editor.SetData("Some data");
}
private void GetSomeData()
{
string data = editor.GetData();
}
}
Configuration
By default, the editor uses a default configuration. You can customize it by setting your own configuration:
<CkEditor5 Configuration="@MyConfiguration" />
@code {
private CkEditorConfiguration MyConfiguration = new CkEditorConfiguration
{
["toolbar"] = new
{
Items = new[]
{
"heading",
"|",
"bold",
"italic",
"link",
"bulletedList",
"numberedList",
"|",
"undo",
"redo"
}
},
["plugins"] = new object[]
{
"Heading",
"Bold",
"Italic",
"Link",
"List",
"Undo",
"Redo"
},
["fontFamily"] = new { supportAllValues = true },
// ...etc
};
}
For a full list of configuration options, refer to the CKEditor5 documentation. You can also view the default configuration in the CkEditor5Configuration.cs file in the source code, which includes the full list of open-source configuration options used by default.
API
The component has the following parameters:
| Parameter | Type | Description |
|---|---|---|
Id |
string? |
The ID of the editor element. |
Class |
string? |
The CSS class of the editor element. |
OnValueChanged |
EventCallback<string> |
Event callback that is triggered when the editor value changes. |
Configuration |
CkEditorConfiguration |
The configuration object for the CKEditor instance. |
Variant |
EditorVariant |
The variant of the CKEditor, the options available are: <br/> ClassicEditor , InlineEditor, BalloonEditor, DocumentEditor <br/> The default is ClassicEditor. |
Value |
string |
The initial value/content of the editor. |
ToggleReadOnly |
bool |
Toggles the editor between read-only and editable mode. |
SetData(string data) |
void |
Sets the data of the editor. |
GetData() |
string |
Gets the data of the editor. |
Versioning
The initial version is 9.44.1, which refers to .NET version 9, CKEditor5 major version 44, and the last number is reserved for work done in this project. This versioning scheme makes it easier to select the appropriate version for your project or so I think 😃
Premium Plugins
The premium plugins are imported and can be configured, but they have not been tested yet. Please note that some features require special configuration or additional JS files to function correctly. Refer to the CKEditor5 documentation for more information.
SaaS features
- Real-time collaboration
- CKBox
- Export to PDF
- Export to Word
- Import from Word
Standalone/offline plugins
- Asynchronous collaboration features, including:
- Track changes
- Comments
- Revision history
- AI Assistant
- Case change
- Document outline
- Format painter
- Merge fields
- Multi-level list
- Pagination
- Paste from Office enhanced
- Slash commands
- Table of contents
- Templates
Issues
In the CKEditor component, anything other than the ClassicEditor cannot use a textarea. Hence, when passing data, it has to be in a regular tag like a div. Unfortunately, you have to cast the data from a string to a MarkupString, which can cause errors when updating the field unless the markup @((MarkupString)Value) is surrounded by tags. I chose a non-existent tag like <x> in <x>@((MarkupString)Value)</x> because in tests it appears to disappear after the first load. If this is not done, the following errors may repeatedly appear in the console:
TypeError: Cannot read properties of null (reading 'removeChild')TypeError: Cannot read properties of undefined (reading 'parentNode')
If you have a solution to this, let me know.
Third-party plugins
If you require a third-party plugin, please inform me, and I will add it to the project. Alternatively, you can create a pull request with the necessary changes, and I will review and merge it. Note the plugin must be compatible with the latest version of CKEditor5 in this project.
Currently added third-party plugins:
| 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
- Microsoft.AspNetCore.Components (>= 10.0.8)
- Microsoft.JSInterop (>= 10.0.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 10.48.1 | 97 | 5/16/2026 |
| 10.48.0 | 113 | 4/17/2026 |
| 10.47.5 | 278 | 3/10/2026 |
| 10.47.4 | 116 | 2/22/2026 |
| 10.47.3 | 109 | 2/18/2026 |
| 10.47.2 | 114 | 2/2/2026 |
| 10.47.1 | 469 | 11/19/2025 |
| 9.46.2 | 195 | 9/13/2025 |
| 9.46.1 | 266 | 8/26/2025 |
| 9.46.0 | 227 | 7/9/2025 |
| 9.45.4 | 217 | 4/18/2025 |
| 9.45.2 | 256 | 4/15/2025 |
| 9.44.1 | 206 | 1/17/2025 |