Skip to content

AiArtifacts

AiArtifacts is an immersive side rendering panel designed to display complex AI-generated content, such as HTML pages, UI prototypes, or large code modules.

Basic Usage

Control visibility via v-model:visible and pass artifact details through the data prop.

Basic Usage

Multi-version Support

Artifacts allow users to switch between different iterations. Use the versions array to provide history and the version-change event to monitor user selection.

Tip: Click v1/v2 at the top of the side panel to experience version switching.
Version Switching

Rendering Modes

Supports preview (live rendering) and code (syntax highlighting) modes. Default mode is preview for HTML content.

Source Mode

Inline Display Mode

By setting mode="inline", the component will appear as a standard block element embedded in the page stream or chat bubbles.

Dashboard Preview
Versions
v1
v2
Inline Mode & Theme Overrides

API

Props

PropertyDescriptionTypeDefault
visibleWhether visiblebooleanfalse
dataArtifact data structureArtifactData
widthPanel widthstring | number'50%'
modeInitial display mode'preview' | 'code' | 'inline''preview'
themeOverridesTheme variable overridesComponentThemeVars

ArtifactData

PropertyDescriptionType
idUnique IDstring
titleTitle/Filenamestring
typeContent type'code' | 'html' | 'markdown' | 'vue' | 'react'
versionsVersion listArtifactVersion[]

ArtifactVersion

PropertyDescriptionType
versionVersion labelstring | number
contentSource code/contentstring
descriptionChanges descriptionstring

Events

NameDescriptionParameters
version-changeTriggered when switching version(v: ArtifactVersion) => void
closeEmitted when closing the panel

Use in Nuxt

This component fully supports Nuxt 3/4. In Nuxt projects, the component will be automatically imported.

For detailed configuration, please see Nuxt Integration.

Theme Variables

Variable NameDescriptionDefault Value
--yh-ai-artifacts-bgPanel background colorvar(--yh-bg-color)
--yh-ai-artifacts-header-heightHeader height56px
--yh-ai-artifacts-border-colorDivider colorvar(--yh-border-color-lighter)
--yh-ai-artifacts-shadowPanel shadowvar(--yh-box-shadow-light)

Released under the MIT License.