← All Components
<mth-artifact-pane>
Tabbed AI artifact viewer with version selection, ClipboardAndShare copy, close action, and @methane-ui/sanitize HTML/Markdown preview.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-artifact-pane>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ai/artifact-pane"></script>
<mth-artifact-pane open kind="code"></mth-artifact-pane>import '@methane-ui/ai/artifact-pane';
import '@methane-ui/react';
export function Example() {
return <mth-artifact-pane open kind="code"></mth-artifact-pane>;
}<script setup lang="ts">
import '@methane-ui/ai/artifact-pane';
</script>
<template>
<mth-artifact-pane open kind="code"></mth-artifact-pane>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ai/artifact-pane';
import { MthArtifactPaneDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthArtifactPaneDirective],
template: `<mth-artifact-pane open kind="code"></mth-artifact-pane>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ai/artifact-pane';
import MthArtifactPane from '@methane-ui/svelte/MthArtifactPane.svelte';
</script>
<MthArtifactPane open kind="code"></MthArtifactPane>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
open | open | boolean | true | Controls whether the artifact pane is visible. |
title | title | string | "" | Artifact display title. |
kind | kind | 'code' | 'html' | 'markdown' | "code" | Artifact content format (code | html | markdown). |
language | language | string | "text" | Language badge shown in the header. |
content | content | string | "" | Artifact source text or markup. |
versions | — | unknown[] | — | Optional array of { id, label, content, kind?, language?, title? } versions. |
activeVersion | active-version | string | "" | Currently selected version ID. |
activeTab | active-tab | 'code' | 'preview' | "code" | Active view mode (code | preview). |
allowRawHtml | allow-raw-html | boolean | false | Controls raw HTML allowance for Markdown previews (false by default). |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-copy | { content: string; ok: boolean } | Fired when artifact source is copied. |
mth-close | { reason: string } | Cancelable event fired when closing the artifact pane. |
mth-version-change | { version: string } | Fired when the user switches artifact versions. |
mth-tab-change | { tab: 'code' | 'preview' } | Fired when toggling between code and preview views. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| ArrowRight | ltr | tab focused | moves focus between Code and Preview tabs (RTL flipped) |
| ArrowLeft | ltr | tab focused | moves focus between Code and Preview tabs (RTL flipped) |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | Focus ownership matches focusModel="none". | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-artifact-pane.spec.test.ts |
| states | Exposes ElementInternals CustomStateSet flags: :state(open), :state(copied). | Conformance suite |
| i18n | Routes 7 UI/ARIA strings through @methane-ui/core i18n catalog. | Locale context test |