Claude Artifacts UI: Media & Artifacts
Claude-style React media components: 6-band voice waveform, image lightbox, split pane, sandboxed Artifacts iframe, diff viewer, code block. 6 live demos.
Media and artifacts covers the interface around voice, images, code and Artifacts: the microphone waveform, the image viewer, the artifact split pane, the sandboxed iframe, the diff viewer and code blocks. The 6 demos on this page correspond to Chapter 5 of the v1 handbook; the official notification sounds are official assets and are not included. This page is a translation of the Chinese demo page.
Key values
| Item | Value | Source |
|---|---|---|
| Voice waveform | 6 bands, non-linear Gamma mapping | v1/05 §5.1.3 |
| Split pane collapse threshold | collapses when dragged within 18% of the edge | v1/05 §5.3 |
| Code block shell | 12px radius, 36px header | v1/05 §5.5.4 |
| Copy success feedback | green check fades out after 2.5 seconds | v1/05 §5.5.4 |
Voice waveform
During voice input, 6 bars show the volume. The demo can use your local microphone; no audio is uploaded.
Image viewer
The image viewer zooms around the cursor and supports dragging, arrow keys to switch images and Esc to close.
Split pane
When the conversation and an artifact sit side by side, the divider in the middle can be dragged; double-click it to return to a 50/50 split.
左侧最小宽度示例里调小到 160px。
Artifact sandbox
Artifacts run in a sandboxed iframe and talk to the host page through postMessage.
Diff viewer
Code changes are marked with added/removed line backgrounds, and you can switch between unified and split views.
| 1 | 1 | export const config = { | |
| 2 | - | port: 3000, | |
| 2 | + | port: Number(process.env.PORT ?? 3000), | |
| 3 | + | host: '0.0.0.0', | |
| 3 | 4 | debug: false, | |
| 4 | 5 | }; |
Code block
Code blocks have a dark shell with a file name and a copy button.
| 1 | export function hello(name: string) { |
| 2 | return `你好,${name}`; |
| 3 | } |
| 4 | |
| 5 | console.log(hello("世界")); |
How do I use these components in a project?
Copy the matching file from code-examples/ and import cds-theme.css. For example:
import { CodeBlock } from './CodeBlock';
<CodeBlock filename="hello.ts" language="typescript" code={src} />Note: some labels inside the demo components are still in Chinese (they come straight from the repository's components); the behavior and specs are the same.
Sources
The specs on this page come from Chapter 5 of the v1 handbook, the component code comes from the repository's code-examples/, and browser APIs follow the MDN documentation.
- open-claude-ui · code-examples/:
LiveMicActivityBars.tsx,MediaLightboxViewer.tsx,ArtifactsSplitPaneResizer.tsx,EpitaxyIframeBridge.tsx,StreamingDiffViewer.tsx,CodeBlock.tsx. - MDN: Web Audio API: the API the voice waveform uses to read microphone volume.
- MDN: The
<iframe>element: thesandboxattribute behind the artifact sandbox. - MDN: Window.postMessage(): how the sandbox and the host page communicate.
- MDN: Pointer events: the pointer events used by the split pane divider and image dragging.
Related pages
Motion & Light
Claude-style motion tokens: 5 durations (60–450ms), 3 cubic-bezier curves, Framer Motion springs, reasoning glow and 28px scroll fade. 5 live React demos.
Desktop Architecture & Interaction Hooks
Claude Desktop-style Electron UI in React: draggable title bar, session reordering, Cowork board, scroll pinning, roving focus, rate-limit backoff. 7 demos.