App components / Text editors
Text editor
A full document: the Editor toolbar on the tray, the page in the card, and the word count and save state below. Each block gets a Block handle on hover, to add a block below, drag it, or open the block menu.
Code
The component itself, ready to drop into your project. Switch between React, Vue and plain HTML; every version uses the same Tailwind classes on Ochre's tokens.
Invoice approvals
Northwind finance approves every invoice twice. This moves approval onto the invoice itself, so one person signs off and the second check happens only above the limit.
- Budget owner named on every invoice
- Approve and schedule payment in one step
Start with finance on NW-118, then every team once the limits are set.
Installation
Examples
Empty
The placeholder until the first word.
Floating toolbar
A comment field: select some text and the toolbar rises over it.
Maya Shah asked for the payment run to move to Thursday. Select this sentence and make it italic, or add a link to the NW-118 ticket.
Block handle
Plus adds below; the grip opens the block menu.
Agenda for Thursday
Payment run moves to Thursday
Sam Okafor owns the rollout
Motion
Built on Ochre's ease-out curves. With reduced motion switched on, everything still works, it just doesn't move.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| defaultValue | string | – | Starting HTML: p, h2, ul, ol, blockquote, strong, em, u, s and a. Leave it out for the Empty state, which shows the placeholder. |
| onChange | (html: string, text: string) => void | – | Called on every change. |
| toolbar | "fixed" | "floating" | "none" | "fixed" | On the tray above the page, over a selection, or none (the shortcuts still work). |
| commands | EditorToolbarEntry[] | – | The toolbar's tools, as in the Editor toolbar. |
| blocks | boolean | true | Block handles: plus adds a block below; the grip drags the block or opens its menu (turn into, move, duplicate, delete). |
| onAsk | (text: string) => void | – | Shows Ask Ochre last on the toolbar, with the selection (or the whole text). |
| saveState / savedAt / onRetry | "saving" | "saved" | "offline" | "failed" | – | The Save status beside the word count. |
| placeholder / label / minHeight | string / string / number | "Start writing" / "Document" / 160 | Empty-state text, the page's accessible name and its least height. |
| BlockHandle | { onAdd?, menu?, onDragStart?, visible? } | – | The plus and grip on their own, for your own block editor. |
Usage
Use it for
- Notes, specs, briefs and long replies that need headings, lists, quotes and links.
- Fixed toolbar for documents; Floating toolbar over a selection for comments and short descriptions.
- Block handles where people reorder sections; turn them off for short fields.
Avoid
- Plain text such as a name or a commit message: use an Input or a Textarea.
- Code: use a Code block, or an editor built for it.
- Tables, images and embeds. This editor is light on purpose: paragraphs, headings, lists, quotes and links.