Artifact Panel

Side canvas that slides open beside a chat (its width eases so the conversation reflows smoothly) to show a generated artifact, with a version switcher whose label rolls by direction, Preview/Code tabs rendering code through CodeBlock, copy, download and close actions, a shared-layout expand into a fullscreen overlay, cross-fading content between versions and a skeleton while a new version generates.

Preview

Artifact Panel preview width

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @karaui/artifact-panel
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

title
ReactNode
—
versions
ArtifactVersion[]
—
filename?
string

Used by the code header and the default download.

artifact.tsx
open?
boolean
—
defaultOpen?
boolean
true
onOpenChange?
((open: boolean) => void)
—
version?
string

Selected version id; defaults to the latest.

—
defaultVersion?
string
—
onVersionChange?
((id: string) => void)
—
tab?
"code" | "preview"
—
defaultTab?
"code" | "preview"
preview
onTabChange?
((tab: ArtifactTab) => void)
—
expanded?
boolean
—
defaultExpanded?
boolean
false
onExpandedChange?
((expanded: boolean) => void)
—
generating?
boolean

A new version is being written: shows a skeleton in place of the content.

false
onDownload?
((version: ArtifactVersion) => void)

Replace the default download (a Blob of the code saved as `filename`).

—
width?
number

Panel width in px when docked beside the chat. Default 400.

400
children?
ReactNode

The chat the panel slides in next to. Omit to render the panel alone.

—
className?
string
—
panelClassName?
string
—

Updated