Overview
Panel artifacts are standalone web apps that run inside iframes and communicate with the Artifactuse SDK via postMessage. You can build custom panels using any framework - React, Vue, Svelte, or vanilla JavaScript.Panels Repository
View source code, development docs, and contribution guidelines
Official Panels
How Panels Work
- SDK detects artifact type in AI response
- SDK loads appropriate panel URL in iframe
- Panel signals ready via
panel:readymessage - SDK sends artifact data via
load:artifactmessage - Panel renders content and sends events back
Communication Protocol
Panels communicate with the SDK using the standardpostMessage API. All messages use the artifactuse type for identification.
SDK → Panel: Loading Artifacts
When the SDK opens a panel, it sends aload:artifact message containing the full artifact data:
Artifact Code Formats
Thecode field contains different formats depending on the panel type:
SDK → Panel: Theme Updates
The SDK sends theme updates when the user changes themes:Panel → SDK
Building a Custom Panel
1
Create project
Set up a project with your preferred framework (React, Vue, Svelte, vanilla JS)
2
Signal ready
Send
panel:ready message when your panel loads3
Handle load:artifact
Listen for
load:artifact message and render the artifact content4
Handle theme changes
Listen for
theme:change message and update your UI5
Send events
Emit events back to the SDK when user interacts
6
Deploy
Host on your CDN and configure SDK to use it
Vanilla JavaScript
Using the Bridge Helper
For convenience, use@artifactuse/shared which handles the message protocol:
- Vue
- React
- Svelte
JSON Sanitization
When parsingartifact.code that contains JSON, you may encounter unescaped newlines inside string values. This happens when the code extractor doesn’t properly escape literal newlines.
Always sanitize before parsing:
json-panel- displays JSON dataform-panel- parses form configurationdiff-panel- parses{oldCode, newCode}structureeditor-panel- parses canvas/video data
svg-panel- raw SVG markuphtml-panel- raw HTML/Markdownreact-panel- raw JSX codevue-panel- raw Vue SFC codecode-panel- raw JavaScript/Python
Theme Support
Panels should support both dark and light themes. The SDK sends theme updates viatheme:change message.
CSS Variables
Use CSS variables for easy theming:Registering Custom Panels
The SDK supports configurable panels that can be added, overridden, or disabled without modifying SDK source code.Configuration Options
Panel Configuration Formats
Runtime Registration
Register panels at runtime with support for type aliases:- Vue
- React
- Svelte
- Vanilla JS
How Panel Routing Works
When the SDK detects an artifact, it looks up the panel URL using:- Artifact type (e.g.,
form,social) - Code language (e.g.,
json,svg,python)
Full Example
Default Panels
The SDK includes these built-in panel mappings:Complete Panel Template
Here’s a complete template for building a custom panel:Resources
Source Code
Browse official panel implementations
Development Guide
Step-by-step guide to building panels
Shared Utilities
Bridge, theme, and component utilities
Contributing
Contribute to official panels