Getting started

    Add a WYSIWYG HTML editor to your Avalonia desktop application. Let users write rich text, paste from Word and edit tables and images, then save HTML for messages, reports and reusable templates. About Avalonia HTML Editor Control →

    Install the NuGet package and add the editor to an Avalonia window. The C# examples below load HTML and export the user's edits; the Quickstart sample provides a complete application.

    Build with .NET SDK 9.0.300 or newer (SDK 10 recommended), targeting .NET 8 or newer. Avalonia 12.1.4 requires the newer compiler. Install Microsoft Edge WebView2 on Windows before running the application.

    Avalonia application showing a service-renewal message, complete HTML editor toolbar, formatted table and next steps.
    Avalonia application showing a service-renewal message, complete HTML editor toolbar, formatted table and next steps.

    Install the NuGet package

    Install SpiceLogic.HtmlEditor.Avalonia 1.0.5 in your Avalonia application project. Build with .NET SDK 9.0.300 or newer, with SDK 10 recommended. The application can target .NET 8 or .NET 10. Keep its Avalonia packages on 12.1.4 and install Microsoft Edge WebView2 on Windows.

    dotnet add package SpiceLogic.HtmlEditor.Avalonia --version 1.0.5

    Add the editor to a window

    The control's namespace and assembly are both SpiceLogic.HtmlEditor.Avalonia. The package supplies its source editor styles; your application uses its normal Avalonia theme.

    <Window xmlns="https://github.com/avaloniaui"
            xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
            xmlns:editor="clr-namespace:SpiceLogic.HtmlEditor.Avalonia;assembly=SpiceLogic.HtmlEditor.Avalonia">
        <editor:AvaloniaHtmlEditor x:Name="HtmlEditor" />
    </Window>

    Load and save after the window opens

    Run document initialization from the owner's Opened workflow after the editor attaches. Awaiting Ready before showing the window prevents the native document surface from starting. Await operations on the UI thread and handle failures in the application's status or validation UI.

    await HtmlEditor.Ready;
    await HtmlEditor.SetBodyHtmlAsync("<p>Welcome to your document.</p>");
    string bodyHtml = await HtmlEditor.GetBodyHtmlAsync();
    string documentHtml = await HtmlEditor.GetDocumentHtmlAsync();

    Body HTML is a fragment. Complete document HTML includes the supported head metadata and styles. An awaited export applies a pending Source draft before returning the current content. Handle a failed apply before saving; do not substitute an older bound property value.

    Quickstart provides complete startup, readiness timeout, error display, cancellation on close and editor disposal. Your application owns persistence and save prompts.

    Related guides

    Last updated on Oct 22, 2026

    Put this into practice.

    Start with the C# Avalonia sample. Restore this edition's package and install the native browser prerequisites before running it.

    Prefer a guided look? Book a free live demo with our engineers - live on Zoom or Teams, never a chatbot.