Cameron Kelliher

AI Artifact

AI chats 8

About

A compound card component for displaying AI-generated artifacts like code snippets, documents, or previews, with a header, title, action buttons (run, copy, regenerate, download, share) and a close control.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds AI Artifact to your project and fits it to your theme.

Code

How AI Artifact is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

import {
  AiArtifact,
  AiArtifactHeader,
  AiArtifactTitle,
  AiArtifactDescription,
  AiArtifactActions,
  AiArtifactAction,
  AiArtifactContent,
  AiArtifactCode,
} from "@/components/ui/ai-artifact";

export default function AiArtifactDemo() {
  return (
    <div className="flex w-full items-center justify-center p-10">
      <AiArtifact
        className="w-full max-w-lg"
        onClose={() => console.log("closed")}
      >
        <AiArtifactHeader>
          <div>
            <AiArtifactTitle>Button Component</AiArtifactTitle>
            <AiArtifactDescription>
              React component with variants
            </AiArtifactDescription>
          </div>
          <AiArtifactActions>
            <AiArtifactAction type="copy" onClick={() => {}} />
            <AiArtifactAction type="download" onClick={() => {}} />
          </AiArtifactActions>
        </AiArtifactHeader>
        <AiArtifactContent>
          <AiArtifactCode
            language="tsx"
            code={`export function Button({ children }) {
  return <button>{children}</button>;
}`}
          />
        </AiArtifactContent>
      </AiArtifact>
    </div>
  );
}

Dependencies

More by Cameron Kelliher

View all
  • AI Chain of Thought

    AI Chain of Thought

    113
  • Helix Loader

    Helix Loader

    97
  • AI Streaming Text

    AI Streaming Text

    51
  • AI Tool Call

    AI Tool Call

    45
  • Signal Bars Loader

    Signal Bars Loader

    42
  • Glitch Text Loader

    Glitch Text Loader

    42
  • AI Prompt Diff

    AI Prompt Diff

    40
  • AI Conversation Tree

    AI Conversation Tree

    34

More in AI chats

View all
  • AI Actions

    AI Actions

    326
  • Agent Chat

    Agent Chat

    18
  • Message Thread

    Message Thread

    45
  • System Message

    System Message

    58
  • Attachments

    Attachments

    22
  • Color Picker

    Color Picker

    110
  • Environment Variables

    Environment Variables

    14
  • AI Diff

    AI Diff

    74