> ## 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.

# Content – Code

> Content provides a scrollable message container with auto-scroll behavior.

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

> [tab] Implementation
>
> ext-atlas-content-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-content-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { Content, UserMessage } from "@servicetitan/anvil2-ext-atlas";
> import { Card } from "@servicetitan/anvil2";
>
> function App() {
>   return (
>     <Card
>       flexDirection="column"
>       gap={2}
>       background="strong"
>       padding="0"
>       style={{ height: "300px", width: "388px" }}
>     >
>       <Content itemsLength={3}>
>         <UserMessage message="First message" />
>         <UserMessage message="Second message" />
>         <UserMessage message="Third message" />
>       </Content>
>     </Card>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ```tsx theme={null}
> import { Content, UserMessage, MarkdownMessage } from "@servicetitan/anvil2-ext-atlas";
>
> function ChatContent() {
>   const messages = [
>     { id: 1, type: "user", content: "Hello!" },
>     { id: 2, type: "assistant", content: "Hi! How can I help you?" },
>   ];
>
>   return (
>     <Content itemsLength={messages.length}>
>       {messages.map((msg) =>
>         msg.type === "user" ? (
>           <UserMessage key={msg.id} message={msg.content} />
>         ) : (
>           <MarkdownMessage key={msg.id} message={msg.content} />
>         )
>       )}
>     </Content>
>   );
> }
> ```
>
> ### With Loading State
>
> Display a loading spinner while fetching initial messages:
>
> ```tsx theme={null}
> import { Content } from "@servicetitan/anvil2-ext-atlas";
>
> function LoadingContent() {
>   const [loading, setLoading] = useState(true);
>   const [messages, setMessages] = useState([]);
>
>   useEffect(() => {
>     fetchMessages().then((data) => {
>       setMessages(data);
>       setLoading(false);
>     });
>   }, []);
>
>   return (
>     <Content itemsLength={messages.length} loading={loading}>
>       {messages.map((msg) => (
>         <Message key={msg.id} {...msg} />
>       ))}
>     </Content>
>   );
> }
> ```
>
> ### Auto-Scroll Behavior
>
> The component automatically scrolls to the bottom when new messages are added:
>
> ```tsx theme={null}
> import { Content, UserMessage } from "@servicetitan/anvil2-ext-atlas";
>
> function AutoScrollContent() {
>   const [messages, setMessages] = useState([]);
>
>   const addMessage = (text) => {
>     setMessages((prev) => [
>       ...prev,
>       { id: Date.now(), content: text },
>     ]);
>     // Content will automatically smooth-scroll to show new message
>   };
>
>   return (
>     <Content itemsLength={messages.length}>
>       {messages.map((msg) => (
>         <UserMessage key={msg.id} message={msg.content} />
>       ))}
>     </Content>
>   );
> }
> ```

> [tab] Content API
>
> ```tsx theme={null}
> <Content
>   itemsLength={messages.length}
>   loading={false}
>   className="custom-content"
> >
>   {messages.map((msg) => (
>     <Message key={msg.id} {...msg} />
>   ))}
> </Content>
> ```
>
> ## `Content` Props
>
> **itemsLength** `number` *required*
>
> The current number of items (messages) in the content. Used to determine when to trigger auto-scroll behavior.
>
> **children** `ReactNode`
>
> The content to render, typically message components.
>
> **className** `string`
>
> Additional CSS class name for custom styling.
>
> **loading** `boolean` (default: false)
>
> When true, displays a Spinner instead of the children content.


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