Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-artifact-pane>

@methane-ui/ai~9.0 KB brotli (kit + Lit)~2.6 KB marginal

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

Interactive StageLive Custom Element · <mth-artifact-pane> (@methane-ui/ai)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
openopenbooleantrueControls whether the artifact pane is visible.
titletitlestring""Artifact display title.
kindkind'code' | 'html' | 'markdown'"code"Artifact content format (code | html | markdown).
languagelanguagestring"text"Language badge shown in the header.
contentcontentstring""Artifact source text or markup.
versions—unknown[]—Optional array of { id, label, content, kind?, language?, title? } versions.
activeVersionactive-versionstring""Currently selected version ID.
activeTabactive-tab'code' | 'preview'"code"Active view mode (code | preview).
allowRawHtmlallow-raw-htmlbooleanfalseControls raw HTML allowance for Markdown previews (false by default).

Events

EventDetail TypeDescription
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

KeyDirectionWhenExpected Behavior
ArrowRightltrtab focusedmoves focus between Code and Preview tabs (RTL flipped)
ArrowLeftltrtab focusedmoves focus between Code and Preview tabs (RTL flipped)

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusFocus ownership matches focusModel="none".lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 2 APG keyboard transitions across LTR/RTL.mth-artifact-pane.spec.test.ts
statesExposes ElementInternals CustomStateSet flags: :state(open), :state(copied).Conformance suite
i18nRoutes 7 UI/ARIA strings through @methane-ui/core i18n catalog.Locale context test