Skip to content

Post Editor

The page a writer lives in: a title and a Markdown body with a toolbar, a side panel for cover, slug, description, tags and publish time, an assistant for the selected text, autosave and a publish bar. Controlled: you own the draft, the save, the publish and the model.

On this page
Used for
  • Writing a post
  • CMS editor
  • Blog admin
  • Documentation drafts

Examples

A new post

On a phone

Installation

Installation is part of Pro

Pro components install from a licensed registry. The live preview stays open to everyone.

Props

draft / onDraftChange
PostDraft / (next) => void
title, slug, description, body (Markdown), tags, cover (a Media library asset or null) and scheduledAt (epoch ms or null). Every edit calls onDraftChange with the whole next draft.
status
PostStatus
Default"draft"
Draws the badge. A published post's button reads Update, a post with a publish time reads Schedule.
saveState / savedAt / onRetrySave
SaveState / number | null / () => void
The autosave indicator. useAutosave(draft, save) returns all three.
onPublish
(draft) => Promise | void
The publish button. Pending until it settles; a rejection shows its message under the bar. The button is off while the title, slug or body is missing, and says which.
assist
RespondFn
The model call, the same contract as the Writing assistant's respond. A rewrite returns the whole new text. Without it the Assist tab is hidden.
suggestions
WritingSuggestion[]
DefaultRewrite, Shorten, Continue
The chips under the assistant's greeting.
assets / assetsLoading / onUpload
MediaAsset[] / boolean / (files) => void
For the cover picker.
tagOptions
string[]
Tags the site already uses, offered while typing.
seo
ReactNode
Adds an SEO tab and a live SEO score in the header. Pass the SEO panel.
suggestNext
(text, { signal }) => Promise<string | null>
Ghost text: the next words, asked for a moment after the person stops typing at the end. Tab takes it all, Ctrl or Cmd with Right one word, Esc drops it.
aiCommand / aiName
(command, { text, signal }) => Promise<string> / string
Default - / Margin
The co-writer. Type / on a new line for Continue writing, Summarise, Change tone and Translate. The answer is written out token by token and then shown as tracked changes to accept or reject one by one.
defaultRun
{ command, original? }
Opens the page with the co-writer already at work, for a first screen that shows it.
underlines
boolean
Defaultfalse
Underlines sentences over 32 words and words written twice. Hover one for the reason and a one-click fix.
preflight
boolean
Defaultfalse
Publish first opens a checklist (SEO score, alt text, publish time) and publishes from there.
useAutosave
(value, save, { delay?, enabled? })
Defaultdelay 1200
Saves after a pause, ignores the first render and a save that a newer one overtook.

Accessibility

  • The title and body are labelled fields; the toolbar buttons are toggle buttons with a pressed state and a name.
  • The save indicator and the publish result are polite live regions; an assistant or publish error is an alert.
  • On a phone the sections are real tabs, and the side panel keeps its own landmark name.

What it handles

  1. 01Edits the title and a Markdown body in the Prompt editor (Tiptap), with a toolbar for bold, italic, heading, list and quote.
  2. 02Keeps cover, slug, description, tags and publish time in a side panel. The slug follows the title until the person writes their own.
  3. 03Picks the cover from the Media library in pick mode: you pass the assets and an upload handler.
  4. 04Works with the Writing assistant on the selected text: Rewrite, Shorten and Continue, a diff before anything changes, Accept to put it in and Undo to take it out. A failed call shows an error with Retry.
  5. 05Shows the autosave state (Saving, Saved 2m ago, Not saved with Retry) and a publish bar whose button reads Publish, Schedule or Update and names what is missing while it is off.
  6. 06Fits a phone with Write, Details, Assist and SEO as tabs, and a second column on a wide block.

States

First render
Nothing. The draft paints as it is
none
Typing, formatting
Nothing moves. The save text changes
none
Autosave
Saving, then Saved, as text. An error turns it red with Retry
none
Assistant answers
The diff card rises in with a short fade
180ms, ease out
Publish
The button shows a pending state until onPublish settles
none
Reduced motion
Everything changes at once
0ms

Works with

When to use

When to use

  • The page where a post is written: title, Markdown body, cover, slug, tags, schedule and an assistant for the selected text.
  • An editor that autosaves and has a publish bar.

When not to use

Using with AI

Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:

  • Add the Knowns UI Post Editor to my app and wire it to my own data.
  • I need the page where a post is written: title, Markdown body, cover, slug, tags, schedule and an assistant for the selected text. Set that up with the Knowns UI Post Editor.
  • Which Post Editor props do I need for a minimal setup? Show me a short example.

With the server connected, your assistant calls get_component({ name: "post-editor" }) and search_docs({ query: "post editor" }). Pro props, full examples and source come back once your license key is in the MCP config.

Need help?

Stuck on Post Editor, or found something off? We read every message.