Skip to content
pandacoderz/ui

Artifact Canvas

Chat beside a live preview and code tabs with a version switcher.

Artifact Canvas
Open preview

What’s inside

  • Chat on the left using Thread, Message, and Prompt Input.
  • Preview renders each version’s HTML in a sandboxed iframe.
  • Code tab shows the source with Shiki highlighting and a copy button.
  • Version switcher steps through history as the assistant makes changes.

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/artifact-canvas.json

The registry item pulls in every component it depends on.

Usage

import ArtifactCanvas from "@/components/blocks/artifact-canvas/artifact-canvas";

export default function Page() {
  return (
    <div className="h-dvh p-4">
      <ArtifactCanvas />
    </div>
  );
}

Give the parent a bounded height. The block fills it and scrolls internally.

Going live

Each assistant turn pushes a new Version. Have your model return the full artifact source per turn, or apply its diff to the previous version before pushing. For non-HTML artifacts swap the iframe for your renderer.