Import
- Vue 3
- Vue 2
- React
- Svelte
Usage
- Vue
- React
- Svelte
Layout
The panel should be a sibling to your chat container in a flex layout:Props
- Vue
- React
- Svelte
These values set the initial position only. Users can still drag the panel edge or split divider to resize. Values outside the valid range are clamped automatically. Props override the global config values (
panelWidth and splitPosition in provideArtifactuse).Events
Handling AI Requests
When users request AI assistance from the panel (e.g., clicking “Fix”, “Improve”, or using the AI input), handle it like this:- Vue
- React
View Modes
The panel supports four view modes:
Control view mode programmatically:
Tab Filtering
Control which tabs are visible when opening artifacts programmatically:The
edit tab only appears when CodeMirror modules are provided via the editor config option. See Code Artifacts for setup instructions.Fullscreen
Toggle fullscreen mode:Panel Controls
The panel header includes:- View mode tabs - Switch between preview/code/split/edit
- Save button - Appears when the edit tab is active (emits
edit:saveevent) - Open in new tab button - Opens the artifact preview URL in a new browser tab (requires
externalPreviewenabled and a preview URL) - Fullscreen button - Expand to full screen
- Close button - Close the panel
- Branding - “Powered by Artifactuse” (can be hidden with license)
- Navigation - Previous/next artifact buttons
- Actions - Copy, download, export buttons
Panel Methods
Control the panel programmatically:openPanel()
Opens the panel in an empty viewer state with no artifact selected. The panel displays an “Artifact Viewer” header and a prompt to open an artifact. When an artifact is subsequently opened (viaopenArtifact(), openFile(), or openCode()), the empty state is automatically cleared.
This is useful for showing the panel before any artifact content is ready — for example, while waiting for an AI response.
Panel Events
Listen for panel lifecycle events:Artifact Navigation
When multiple artifacts exist, users can navigate between them using the footer controls or programmatically:Multi-Tab
Enable multi-tab mode to open multiple artifacts as tabs, similar to a code editor:- Clicking an artifact card or calling
openFile()/openCode()opens it in a new tab (or focuses it if already open) - Each tab preserves its own view mode (preview, code, split, edit)
- Closing the active tab switches to the adjacent tab
- The prev/next navigation is replaced by the tab bar
- Artifacts from streamed messages do not auto-open as tabs
Tab Methods
State
When multi-tab is active, two additional state fields are available:Multi-tab is opt-in and disabled by default. When
multiTab: false (default), the panel behaves exactly as before with single-artifact navigation.Mobile Behavior
On mobile devices (< 768px), the panel:- Opens as a full-screen overlay
- Hides the resize handle
- Shows a backdrop behind the panel
- Uses vertical split in split mode
Vue 2 Portal
For Vue 2, the panel usesportal-vue for fullscreen/mobile rendering. Add the portal target: