A compact writing helper for editors and sidebars: the cloud Agent Avatar as its face, rewrites as a word-level diff you accept or discard, dictation, and the host's selected text handed in and out.
Examples
Dictation
Rewrite as a diff
Your accent
Installation
Installation is part of Pro
Pro components install from a licensed registry. The live preview stays open to everyone.
Props
- selection
string- Default
"" - The text highlighted in your editor. Rewrite actions act on it and are disabled when it is empty. The card shows what it is working on.
- respond
(message, { selection, action, signal }) => string|Promise<string>|AsyncIterable<string>- Default
stand-in - Your model call. For a rewrite action return the whole new text; a plain message may stream chunks. signal aborts when the person stops or sends again. Without it a small built-in stand-in answers, so the card runs with no model.
- onAccept
(text, { action, original }) => void- The person accepted a rewrite or inserted a draft: replace the selection with text in your editor.
- onUndo
(original) => void- The person undid an accepted rewrite: put original back. Without it Undo calls onAccept with the original.
- suggestions
{ id, label, action?, prompt? }[]- Default
Shorten, Fix the tone, Polish, Translate, Draft a reply - Chips under the greeting. An action rewrites the selection (built in: shorten, fix-tone, polish, translate; any other string is passed to respond). Without an action the chip sends its prompt as a message.
- name / tagline / greeting / placeholder
string / string / ReactNode / string- Default
"Margin" / "Writing help in your draft" - All overridable. The name also labels the avatar and the region.
- speech
"auto"|"simulate"- Default
"auto" - auto dictates with the Web Speech API in the page language and plays a sample take when the browser has none or recognition fails; simulate always plays it. The dictated words land in the message box, ready to edit.
- lang / simulatedTake
string / string- Default
page language - Dictation language (BCP 47) and the words of the sample take.
- paused
boolean- Default
false - Holds the avatar still.
- Theming
-- The glow, buttons, level bars, diff underline and avatar follow --kn-accent, which defaults to --primary. Light and dark follow the page theme.
- Keyboard
-- Enter sends, Shift+Enter adds a line, Cmd or Ctrl+Enter accepts the open rewrite, Escape discards it or stops dictating. Everything is reachable with Tab; the mic is a toggle (aria-pressed) and new messages and state changes are announced politely.
- Motion
-- The avatar listens while you dictate, thinks while it writes, speaks while a draft streams, smiles when you accept and looks worried on an error. Reduced motion holds still poses and static level bars. The card follows its own width (container queries), down to a narrow sidebar.
| Prop | Type | Default | Description |
|---|---|---|---|
| selection | string | "" | The text highlighted in your editor. Rewrite actions act on it and are disabled when it is empty. The card shows what it is working on. |
| respond | (message, { selection, action, signal }) => string | Promise<string> | AsyncIterable<string> | stand-in | Your model call. For a rewrite action return the whole new text; a plain message may stream chunks. signal aborts when the person stops or sends again. Without it a small built-in stand-in answers, so the card runs with no model. |
| onAccept | (text, { action, original }) => void | - | The person accepted a rewrite or inserted a draft: replace the selection with text in your editor. |
| onUndo | (original) => void | - | The person undid an accepted rewrite: put original back. Without it Undo calls onAccept with the original. |
| suggestions | { id, label, action?, prompt? }[] | Shorten, Fix the tone, Polish, Translate, Draft a reply | Chips under the greeting. An action rewrites the selection (built in: shorten, fix-tone, polish, translate; any other string is passed to respond). Without an action the chip sends its prompt as a message. |
| name / tagline / greeting / placeholder | string / string / ReactNode / string | "Margin" / "Writing help in your draft" | All overridable. The name also labels the avatar and the region. |
| speech | "auto" | "simulate" | "auto" | auto dictates with the Web Speech API in the page language and plays a sample take when the browser has none or recognition fails; simulate always plays it. The dictated words land in the message box, ready to edit. |
| lang / simulatedTake | string / string | page language | Dictation language (BCP 47) and the words of the sample take. |
| paused | boolean | false | Holds the avatar still. |
| Theming | - | - | The glow, buttons, level bars, diff underline and avatar follow --kn-accent, which defaults to --primary. Light and dark follow the page theme. |
| Keyboard | - | - | Enter sends, Shift+Enter adds a line, Cmd or Ctrl+Enter accepts the open rewrite, Escape discards it or stops dictating. Everything is reachable with Tab; the mic is a toggle (aria-pressed) and new messages and state changes are announced politely. |
| Motion | - | - | The avatar listens while you dictate, thinks while it writes, speaks while a draft streams, smiles when you accept and looks worried on an error. Reduced motion holds still poses and static level bars. The card follows its own width (container queries), down to a narrow sidebar. |
A heavy rewrite opens as the finished text rather than a pile of struck words; the Changes and Result switch lets the reader flip between the two. The word-level diff comes from Prose Diff, and drafts stream with Token Stream.
When to use
When to use
- A writing helper docked beside an editor, a CRM note or an email composer: rewrite the highlighted text and hand the result back.
- Dictating a first draft, then tightening it with one tap.
- A narrow sidebar or sheet: the card follows the width of its host.
When not to use
- A full conversation with history and attachments: use Chat Composer.
- An inline suggestion inside the text itself: use Inline Diff.
- A face with no writing job: use Agent Avatar.
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 Writing Assistant to my app and wire it to my own data.
- I need a writing helper docked beside an editor, a CRM note or an email composer: rewrite the highlighted text and hand the result back. Set that up with the Knowns UI Writing Assistant.
- Which Writing Assistant props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "writing-assistant" }) and search_docs({ query: "writing assistant" }). Pro props, full examples and source come back once your license key is in the MCP config.