Skip to content

Artifact Canvas

The panel beside a chat for what the agent made: a document or a piece of code with its versions, a diff against the one before, copy and Apply. On a phone it opens in a bottom sheet.

On this page

Examples

Open an artifact, pick a version, look at Changes, then Apply.

Installation

Installation is part of Pro

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

Props

ArtifactCanvas: artifact
Artifact
{ id, title, kind: "code" | "document", language?, filename?, versions }. Each version is { id, content, summary, time? }, oldest first. Documents read #, ##, ### headings, - and 1. lists, **bold** and `code`.
version / defaultVersion / onVersionChange
string (version id)
Defaultnewest
The version on screen. Changes compare it with the one before; the first version has nothing to compare.
tab / defaultTab / onTabChange
"view" | "changes"
Default"view"
The code or document as it is, or a line diff against the previous version (unified, with changed words marked).
applied / onApply
string / (version) => void
The version id that is applied now, and the callback for the Apply button. Apply is a callback to your app: it writes the file or the page and you set `applied` afterwards.
onClose
() => void
Shows a close button.
ArtifactCard
{ artifact, versionId?, active?, onOpen }
The reference inside a chat message. One button that opens the canvas.
ArtifactSplit: chat / canvas / open / onOpenChange
ReactNode / ReactNode / boolean / (open) => void
Chat and canvas side by side with a draggable divider (canvas 46%, 30 to 70). While open is false only the chat shows.
ArtifactSplit: onModeChange
(mode: "inline" | "sheet") => void
Called when the container is measured and when it crosses mobileBelow. Open the canvas on load only when the mode is inline: in sheet mode it is a modal over the page.
ArtifactSplit: mobileBelow / storageKey
number / string
Default720 / -
Below this container width the canvas opens in a bottom Sheet. storageKey remembers the divider.
a11y
section, status
The canvas is a named section (title and version). The version list is a popover of buttons with aria-current. Copy is announced politely.

When to use

When to use

  • Showing the document or code an agent wrote beside the chat, so it stays out of the message stream.
  • Letting people compare versions, copy one, or apply it to their file or page.

When not to use

  • Many files changed at once, or AI edits to accept one by one: use Inline Diff.
  • A code snippet inside a message: use Code Block.

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 Artifact Canvas to my app and wire it to my own data.
  • I need showing the document or code an agent wrote beside the chat, so it stays out of the message stream. Set that up with the Knowns UI Artifact Canvas.
  • Which Artifact Canvas props do I need for a minimal setup? Show me a short example.

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

Need help?

Stuck on Artifact Canvas, or found something off? We read every message.