Prodular UI

Artifact

AIPro

A panel for something the model generated, such as a document, a chart or code, with versions, Preview and Code tabs, copy, download and full screen, and a streaming state.

npx prodular-ui add artifact

Part of Prodular UI Pro. Preview and read the docs freely, install with a license. See pricing

Document with versions

Step through versions, switch to the Markdown source, copy, download or open it full screen. Regenerate writes a new version.

Q3 vendor spend summary

Shorter, for the board pack · from 1,284 transactions

v3 of 3

Q3 vendor spend

Q3 vendor spend was $412,800, up 6% on Q2. Cloud drove most of the increase. Northbeam Legal rose 31% on the MSA review and renews in November.

VendorQ3 spendvs Q2
Lumen Cloud Services$128,400+14%
Halcyon Freight$96,250+2%
Brightline Payroll$61,9000%
Northbeam Legal$38,100+31%
Edited versions are kept for 30 days

Streaming

While the model writes, the description shimmers and a thin AI line runs along the top of the panel.

Labor hours by region, October

Querying work orders

  • Northeast
  • Midwest
  • South
  • Mountain
  • Pacific

Rows appear as the query returns them.

Anatomy

<Artifact status="ready">  <ArtifactHeader>    <ArtifactTitle>      <ArtifactName>Q3 vendor spend summary</ArtifactName>      <ArtifactDescription>From 1,284 transactions</ArtifactDescription>    </ArtifactTitle>    <ArtifactVersions versions={["v1", "v2", "v3"]} value={v} onValueChange={setV} />    <ArtifactTabs>      <ArtifactTab value="preview">Preview</ArtifactTab>      <ArtifactTab value="code">Code</ArtifactTab>    </ArtifactTabs>    <ArtifactActions>      <ArtifactCopyButton value={source} />      <ArtifactDownloadButton filename="summary.md" content={source} />      <ArtifactFullscreenButton />    </ArtifactActions>  </ArtifactHeader>  <ArtifactPanel value="preview">{/* rendered */}</ArtifactPanel>  <ArtifactPanel value="code"><ArtifactCode code={source} /></ArtifactPanel></Artifact>

Guidance

Use it when

  • Use it when the model produces a self contained result people keep, edit or export: a report, a chart, a query, a template.
  • Keep every version and let people step back with ArtifactVersions. Name what changed in ArtifactDescription.
  • Offer a Code or Source tab whenever the preview is rendered from text, so people can copy the real thing.
  • Use status="streaming" for the first version and status="updating" while a new version replaces the current one.

Avoid

  • Wrapping it in another card. It is the container.
  • Replacing a version in place. Add a new one.
  • Short answers. A sentence or a number belongs in the message, not an artifact.

Rules for AI agents

Published in llms-full.txt, the registry and the MCP server, so coding agents follow them when they build with this component.

  • Pass status on every render: streaming while the first version arrives, updating while a new version is written, ready when done, failed on error.
  • Keep versions immutable. Append a new id to versions and select it; never mutate the content of an existing version.
  • Give every icon action a label through ArtifactAction, ArtifactCopyButton, ArtifactDownloadButton or ArtifactFullscreenButton. Copy and download the source text, not the rendered HTML.
  • Disable copy and download while streaming, or copy only what has arrived and say so.
  • Use ArtifactPanel values that match ArtifactTab values, and default to the preview tab.

API

Artifact

PropTypeDefaultDescription
status"streaming" | "updating" | "ready" | "failed""ready"Exposed as data-status. Drives the shimmer, the progress line and aria-busy.
defaultTab / tab / onTabChangestring"preview"The active tab, uncontrolled or controlled.

ArtifactTitle

PropTypeDefaultDescription
modelstringThe model that produced it, in the AI mark tooltip.

ArtifactDescription

PropTypeDefaultDescription
streamingLabel / updatingLabelstring"Generating" / "Writing a new version"Replaces the description while busy.

ArtifactVersions

PropTypeDefaultDescription
versions / value / onValueChangestring[] / string / (v: string) => voidVersion ids, oldest first.

ArtifactAction

PropTypeDefaultDescription
labelstringTooltip and accessible name of an icon action.

ArtifactDownloadButton

PropTypeDefaultDescription
filename / content / mimeTypestring / string | Blob / stringDownloads the content as a file.

ArtifactCode

PropTypeDefaultDescription
code / lineNumbersstring / booleanlineNumbers trueSource view for the code tab.

Installation

The Prodular UI CLI adds the source to components/ui with everything it depends on. In a project that already uses shadcn/ui, the shadcn CLI installs it from the Prodular registry too. See Installation for the first setup.

npx prodular-ui add artifact# or, with the registry in components.jsonnpx shadcn@latest add @prodular/artifact

Used in these screens