Artifact sheet (Pro)
ProIncluded in $99An artifact opens as a near full height sheet and the chat steps back behind it, scaled down with rounded corners.
On this page
Installation
Needs chatcn Pro
This command works with a Pro license, along with every Pro component.
Or start free: sign up and get three Pro components on us, with a new one every month.
Usage
import { ArtifactSheet } from "@/components/ui/chatcn/pro/artifact-sheet"
<ArtifactSheet
open={open}
onOpenChange={setOpen}
title="createIntent.patch"
subtitle="Patch · 1 file"
icon={<FileDiffIcon />}
actions={<CopyButton value={patch} label="Copy patch" />}
content={<DiffViewer patch={patch} />}
returnFocus={cardRef}
>
<ChatScreen /> {/* the chat it covers */}
</ArtifactSheet>Wrap the chat screen in it. When it opens, the chat scales down, drops just below the status bar and rounds its top corners over a dark backdrop, the way native apps stack a card over what opened it, so it is clear the chat is still there. The chat follows the sheet exactly: on the same spring when the sheet moves on its own, and 1:1 with the finger while it is dragged down, so pulling the sheet brings the chat forward. A flick or a pull past the threshold closes it. The header holds the artifact's name, a line under it, your actions and Close; it drags from anywhere except its buttons. The chat behind is inert while the sheet is up. In a phone frame, turn the status bar light while it is open, as the demo does.
Examples
States
Props
| Prop | Type | Notes |
|---|---|---|
open, onOpenChange | boolean | Controlled |
title, subtitle, icon | The header | |
actions | ReactNode | Buttons before Close |
content | ReactNode | The artifact |
returnFocus | RefObject<HTMLElement> | Usually the card that opened it |
children | ReactNode | The screen behind |
labels | Partial<ArtifactSheetLabels> | Every string, for translation |
Keyboard
| Key | Action |
|---|---|
| Escape | Close; focus returns to the card |
| Arrow down on the grabber | Close |
| Tab | Stays inside the sheet |
Accessibility
- The sheet is a modal dialog named by the artifact; the chat behind is inert while it is open.
- Close is a real button, so the gesture is never the only way out.
Motion
The sheet and the chat behind move together on a critically damped spring over about 520 ms; the chat scales to 92% and rounds its corners with clip-path. Under reduced motion the sheet slides in 150 ms and the chat does not scale.