Rich text editorPro
A lightweight editor with markdown shortcuts, a floating toolbar with a link face, a slash menu, its own undo and redo, and clean HTML and Markdown out.
oxyn add rich-text-editorType to see the output…
The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.
Rendered from Rust at build time · goes live when visible
When to use
- A lightweight block editor drawn by Oxyn (no contentEditable) on kit::compose::Doc.
- Markdown shortcuts at a line start (# , ## , ### , - /* , 1. , [] , > , ``` ` ``, ---).
- Marks: bold, italic, strikethrough, inline code (within one block) and links, toggled on the selection or for the next typed text.
- Selecting text (Shift+arrows, Home/End, or dragging) shows a floating toolbar over the line; its face swaps to a link field (⌘K or the link button). /` after a space or at a line start opens the block menu, which filters as you type; ↑ ↓ move, Enter or Tab chooses, Escape closes.
When not to use
- Prompt composer with model picker, voice input, app connections and approval request: use Chat Composer instead.
- The model menu of an AI chat: use Model Picker instead.
- The prompt box for an agent, in six layouts: use Composer instead.
Installation
Rich text editor is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.
oxyn add rich-text-editorUsage
The preview is free. Pro opens the code of every Pro component, screen and template.
Examples
Default
Select text for the toolbar; type / for blocks.
Type to see the output…
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Html
Clean HTML out, with custom undo buttons.
Type to see the output…
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
Empty
Empty: placeholder and the block hint.
Type to see the output…
Code Pro
The preview is free. Pro opens the code of every Pro component, screen and template.
API reference
RichTextEditor
| Prop | Type | Default | Description |
|---|---|---|---|
markdown | String | Default::default() | Starting content as Markdown. |
placeholder | String | "Start writing" | Shown when empty. |
block_hint | String | "Type / for blocks" | Hint on an empty line holding the caret. |
read_only | bool | Default::default() | No editing, toolbar or shortcuts. |
history_bar | bool | Default::default() | Undo and redo buttons above the editor. |
label | String | "Editor" | Accessible name. |
on_change | EventHandler<(String, String, String)> | — | After each edit: HTML, Markdown and plain text. |
Read from the Rust signature and doc comments.
Keyboard interactions
| Key | Action |
|---|---|
| ⌘Bor⌘Ior⌘⇧Xor⌘E | Bold, italic, strike, code |
| ⌘K | Link the selection |
| ⌘Zor⌘⇧Zor⌘Y | Undo / redo |
| / | Block menu (↑ ↓ Enter Tab Escape) |
| TaborShiftTab | Indent a list item; two spaces in code |
| EnterorShiftEnter | New block / line break |
Accessibility
- role=textbox with aria-multiline; toolbar buttons expose aria-pressed.
- Reduced motion jumps the toolbar and fades the menus.
From the spec
- role=textbox, aria-multiline; toolbar buttons have aria-pressed; the slash menu is a listbox.
Motion & interaction
Timing
- Toolbar glides 200 ms with the selection; faces crossfade 160 ms; slash highlight glides 140 ms.
- Reduced motion jumps the toolbar and fades the menus.
Responsive behaviour
- Fills its container up to 560 px.
Edge cases (spec)
- Fills its container up to 560 px.
Notes for AI
- Import
RichTextEditorfromoxyn_dioxusand includeSTATUS_INDICATOR_CSSplus the token stylesheet once. - A GPUI version exists:
RichTextElinoxyn_gpui. - Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.