> ## Documentation Index
> Fetch the complete documentation index at: https://anvil.servicetitan.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Artifact Card – Code

> ArtifactCard is the in-chat trigger that opens an ArtifactPanel for an artifact surfaced by the Atlas agent.

> [!WARNING]
>
> Atlas is deprecated. Use [AI Kit](https://anvil.servicetitan.com/docs/building-agentic-experiences) for any new Atlas experiences.

> [tab] Implementation
>
> ext-atlas-artifact-card-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-artifact-card-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { ArtifactCard } from "@servicetitan/anvil2-ext-atlas";
> import { Flex } from "@servicetitan/anvil2";
>
> function App() {
>   return (
>     <Flex direction="column" gap={3} style={{ width: "600px" }}>
>       <ArtifactCard
>         title="Insights for Invoice #10492"
>         description="Single-visit industrial install, closed under quote with a 40% margin."
>         artifactId="insight-1"
>         onClick={() => console.log("artifact 1 clicked")}
>       />
>       <ArtifactCard
>         title="Customer note draft"
>         description="Plain-language summary of the variance for sending to the customer."
>         artifactId="insight-2"
>         active
>         onClick={() => console.log("artifact 2 clicked")}
>       />
>     </Flex>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ### Basic Usage
>
> Render an artifact trigger with a title and description:
>
> ```tsx theme={null}
> import { ArtifactCard } from "@servicetitan/anvil2-ext-atlas";
>
> function ArtifactTrigger() {
>   return (
>     <ArtifactCard
>       title="Insights for Invoice #10492"
>       description="Single-visit industrial install, closed under quote with a 40% margin."
>       artifactId="insight-1"
>       onClick={() => openPanel("insight-1")}
>     />
>   );
> }
> ```
>
> ### Active State
>
> Pass `active` while the corresponding `ArtifactPanel` is open so the card shows the elevated visual state:
>
> ```tsx theme={null}
> import { ArtifactCard } from "@servicetitan/anvil2-ext-atlas";
>
> function ActiveTrigger({ openId, onOpen }) {
>   return (
>     <ArtifactCard
>       title="Customer note draft"
>       description="Plain-language summary of the variance."
>       artifactId="insight-2"
>       active={openId === "insight-2"}
>       onClick={() => onOpen("insight-2")}
>     />
>   );
> }
> ```
>
> ### Pairing with ArtifactPanel
>
> Wire the card's `onClick` to the consumer state that drives an `ArtifactPanel`:
>
> ```tsx theme={null}
> import { useState } from "react";
> import { ArtifactCard, ArtifactPanel } from "@servicetitan/anvil2-ext-atlas";
>
> function ChatWithArtifact() {
>   const [activeId, setActiveId] = useState<string | null>(null);
>   return (
>     <>
>       <ArtifactCard
>         title="Insights for Invoice #10492"
>         description="Single-visit industrial install."
>         artifactId="insight-1"
>         active={activeId === "insight-1"}
>         onClick={() => setActiveId("insight-1")}
>       />
>       <ArtifactPanel
>         isOpen={activeId !== null}
>         onOpenChange={(open) => {
>           if (!open) setActiveId(null);
>         }}
>         title="Insight details"
>         triggerKey={activeId ?? undefined}
>       >
>         {/* artifact content */}
>       </ArtifactPanel>
>     </>
>   );
> }
> ```
>
> ## React Accessibility
>
> * The card renders as a `role="group"` wrapping an interactive button via Anvil2's `InteractiveCard`. The whole surface is clickable.
> * The `title` is used for both the wrapper's `aria-label` and the action button's `aria-label` (prefixed with "View ").
> * `artifactId` is emitted as `data-artifact-id` for analytics and event wiring; it is not announced to assistive technology.

> [tab] ArtifactCard API
>
> ```tsx theme={null}
> <ArtifactCard
>   title="Insights for Invoice #10492"
>   description="Single-visit industrial install."
>   artifactId="insight-1"
>   active={false}
>   onClick={handleClick}
> />
> ```
>
> ## `ArtifactCard` Props
>
> **description** `string` *required*
>
> Supplementary description shown beneath the title.
>
> **onClick** `() =\> void` *required*
>
> Called when the card is activated. Consumers typically open the corresponding `ArtifactPanel` here.
>
> **title** `string` *required*
>
> Bold heading rendered inside the card.
>
> **active** `boolean` (default: false)
>
> When true, the card shows the active visual state. Set when the corresponding `ArtifactPanel` is open.
>
> **artifactId** `string`
>
> Identifier for the artifact this card references. Emitted as a `data-artifact-id` attribute for analytics and event handling.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.