Import
- Vue 3
- Vue 2
- React
- Svelte
Usage
- Vue
- React
- Svelte
Props
Events
Event names use kebab-case in Vue (
@form-submit) and camelCase in React (onFormSubmit). Svelte uses kebab-case with on: prefix (on:form-submit).Artifact Rendering
The component automatically renders different artifact types:Inline Code Preview
By default, code artifacts render as clickable cards. EnableinlinePreview in your SDK config to show truncated syntax-highlighted code previews directly in the message:
Clicking a truncated preview opens the full artifact in the panel. Languages not listed still render as cards.
Inline code preview requires Prism.js for syntax highlighting. Load Prism and language grammars via CDN or npm.
Exclude Languages
When usinglanguages: true, exclude specific languages from inline preview with excludeLanguages. Excluded languages fall back to artifact cards:
languages: true. When languages is an array, simply omit the language from the array instead.
Non-Clickable Short Code
When code is shorter thanmaxLines, the full code is visible — clicking opens a panel that shows the same content. Use minClickableLines to disable clicking for these short blocks:
ignoreLanguages to keep them clickable:
Custom Action Labels
Customize the fade overlay label text per language:(N lines) suffix is always appended automatically (e.g., “Open preview (24 lines)”).
Inline Code
To show full syntax-highlighted code directly in the message without extraction or panel, enableinlineCode:
Code blocks for listed languages stay as normal
<pre><code> blocks with Prism.js syntax highlighting. No artifact card, no panel, no extraction.
When a language matches both
inlineCode and inlinePreview, inlineCode takes priority (no extraction).Tabs & View Mode
Control which panel tabs are visible and the initial view mode, globally or per-message:'preview', 'code', 'split', 'edit'. Available view modes match the tab names.
Config Precedence
All options support both global config and component prop levels. Precedence: Component prop → Global config → DefaultForm Collapse Behavior
Inline forms automatically collapse after user interaction to prevent duplicate submissions and keep the chat clean.Form States
Behavior Rules
- Current session: Forms stay active until user interacts
- After submit/cancel/custom action: Form collapses immediately
- After page refresh:
- Last message forms stay active (via
isLastMessageprop) - Older message forms collapse as inactive
- Last message forms stay active (via
- Reset action: Form stays active (doesn’t collapse)
Example with isLastMessage
Media Lightbox
Images and PDFs automatically open in a fullscreen lightbox viewer when clicked. The viewer supports:- Zoom - Click image or zoom button to toggle zoom
- Download - Download the original file
- Keyboard - Press
Escapeto close - Click outside - Click overlay to close
Typing Indicator
Show a typing indicator while streaming AI responses:typing becomes false.
Example: Full Integration
- Vue
- React