> ## 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 Panel Layout – Code

> ArtifactPanelLayout is the row container that orchestrates the responsive behavior of nested ArtifactPanel components.

> [!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-panel-layout-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-artifact-panel-layout-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import {
>   ArtifactCard,
>   ArtifactPanel,
>   ArtifactPanelLayout,
> } from "@servicetitan/anvil2-ext-atlas";
> import { Flex, Text } from "@servicetitan/anvil2";
> import { useState } from "react";
>
> function App() {
>   const [activeId, setActiveId] = useState<string | null>(null);
>   return (
>     <Flex direction="column" style={{ width: "1000px", height: "500px" }}>
>       <ArtifactPanelLayout style={{ flex: 1, minHeight: 0 }}>
>         <Flex
>           direction="column"
>           gap={3}
>           style={{ flex: 1, padding: 16, minWidth: 0 }}
>         >
>           <Text>
>             I checked invoice 10492 against the service agreement and technician
>             notes. One thing to flag: labor came in 1.5 hours over the approved
>             estimate.
>           </Text>
>           <ArtifactCard
>             title="Insights for Invoice #10492"
>             description="Single-visit industrial install, closed under quote with a 40% margin."
>             artifactId="insight-1"
>             active={activeId === "insight-1"}
>             onClick={() => setActiveId("insight-1")}
>           />
>         </Flex>
>         <ArtifactPanel
>           isOpen={activeId !== null}
>           onOpenChange={(open: boolean) => {
>             if (!open) setActiveId(null);
>           }}
>           position="right"
>           title="Supplemental info"
>           description="Variance details for invoice 10492"
>           triggerKey={activeId ?? undefined}
>         >
>           Resize the surrounding viewport to see the panel switch between inline
>           and overlay modes.
>         </ArtifactPanel>
>       </ArtifactPanelLayout>
>     </Flex>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ### Basic Usage
>
> Wrap the chat content and any nested `ArtifactPanel` components in `ArtifactPanelLayout`. The layout establishes the positioning context and decides whether each registered panel sits inline or overlays the chat:
>
> ```tsx theme={null}
> import {
>   ArtifactPanel,
>   ArtifactPanelLayout,
> } from "@servicetitan/anvil2-ext-atlas";
>
> function ChatLayout({ messages, panelOpen, setPanelOpen }) {
>   return (
>     <ArtifactPanelLayout>
>       <Content itemsLength={messages.length}>{messages}</Content>
>       <ArtifactPanel
>         isOpen={panelOpen}
>         onOpenChange={setPanelOpen}
>         title="Supplemental info"
>       >
>         {/* artifact content */}
>       </ArtifactPanel>
>     </ArtifactPanelLayout>
>   );
> }
> ```
>
> ### Responsive Behavior
>
> The layout observes its own width and decides per-panel whether enough room is available to sit inline alongside the chat. Inline mode kicks in only when the chat content would still have at least 20rem of room; otherwise the panel switches to overlay mode and floats over the chat anchored to the appropriate edge.
>
> Mode is read from a context internal to `ArtifactPanelLayout` — consumers do not need to compute or pass it. When an `ArtifactPanel` is rendered outside `ArtifactPanelLayout`, it falls back to inline mode.
>
> ## React Accessibility
>
> * The layout itself is a presentational `<div>` with no semantics — accessibility is handled by the components nested inside (chat content, `ArtifactPanel` aside landmark, etc.).
> * The layout establishes a positioning context (`position: relative`) so absolutely-positioned overlay panels anchor correctly without consumers needing to wire that up themselves.

> [tab] ArtifactPanelLayout API
>
> ```tsx theme={null}
> <ArtifactPanelLayout>
>   <ChatContent />
>   <ArtifactPanel ... />
> </ArtifactPanelLayout>
> ```
>
> ## `ArtifactPanelLayout` Props
>
> **children** `ReactNode` *required*
>
> The chat content and any nested `ArtifactPanel` components.


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