Skip to content

Repository files navigation

dioxus-editor

A pluggable rich-text editor for Dioxus — transaction-based document model, Markdown input/output, decorators, history, and a contenteditable view. Entirely in Rust.

CI Release License: MIT OR Apache-2.0 Rust 1.88+ Dioxus 0.7 – 0.8 Used in production at slick.chat

dioxus-editor kitchen sink demo

Warning

The 2.x line targets Dioxus 0.8 while Dioxus itself is in alpha.

Features

  • Transaction-based core — every change is an explicit, inspectable Transaction; no hidden DOM state
  • Markdown in and out# , **bold**, > , and list shortcuts as you type, plus full Markdown import/export
  • Pluggable — keymaps, undo/redo history, and Markdown shortcuts are plugins you opt into
  • Decorators — render arbitrary Dioxus components (links, embeds, @mentions with a custom picker) as schema-backed nodes inside the document
  • Editable tables — with keyboard navigation between cells
  • Accessible — ARIA-labelled, keyboard-first editing
  • Bring your own styling — the crate exposes semantic CSS class names but ships no CSS; applications own all editor styling (see the styling reference)

Quick start

[dependencies]
dioxus-editor = { git = "https://github.com/danielkov/dioxus-editor", tag = "v2.0.0-alpha.1" }
use dioxus::prelude::*;
use dioxus_editor::{plugins, use_editor, EditorConfig, EditorView, Schema};

#[component]
fn App() -> Element {
    let editor = use_editor(|| {
        EditorConfig::new(Schema::new())
            .with_plugin(plugins::DefaultKeymap)
            .with_plugin(plugins::History::new())
            .with_plugin(plugins::MarkdownShortcuts::new())
    });

    rsx! { EditorView { editor, aria_label: "Article body" } }
}

By default, Enter splits the current block. Supplying on_submit opts into submit-on-Enter; Shift+Enter always splits the block.

Styling

The editor renders semantic class names (editor__* for blocks, e-t/e-b/ e-i/e-s/e-c for text runs) and ships no CSS of its own. The styling reference documents every class and data attribute the crate emits, plus the two CSS rules the editor relies on to behave correctly.

Compatibility and version policy

dioxus-editor Dioxus Minimum Rust Status
1.x >=0.7.10, <0.8 1.88 Maintained
2.x >=0.8, <0.9 1.88 Maintained

Major editor versions track Dioxus compatibility. The maintained 1.x/Dioxus 0.7 line is available from the 1.x branch.


Slick — team chat engineered for the AI age. Built for shipping. Not for billing. dioxus-editor powers its rich-text messaging. Try it at slick.chat

Contributing

Contributions are welcome. See CONTRIBUTING.md for the development setup, test suite, and how the demo gif is regenerated.

License

Licensed under either Apache License 2.0 or MIT, at your option.

About

A pluggable rich-text editor for Dioxus

Topics

Resources

Contributing

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages