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

# Toolbox – Code

> Toolbox provides action buttons for message interactions.

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

> [tab] Implementation
>
> ext-atlas-toolbox-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-toolbox-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { Toolbox, UserFeedback } from "@servicetitan/anvil2-ext-atlas";
> import { Card, Flex, Text } from "@servicetitan/anvil2";
> import { useState } from "react";
>
> function App() {
>   const [feedback, setFeedback] = useState<UserFeedback>(UserFeedback.None);
>
>   return (
>     <Flex direction="column" gap={4} style={{ width: "388px" }}>
>       <Card flexDirection="column" gap={2} background="strong">
>         <Text size="medium" variant="eyebrow">
>           All Actions Available
>         </Text>
>         <Toolbox
>           text="This is a sample response text that can be copied to clipboard."
>           onRetry={async () => console.log("retry clicked")}
>           onLike={async () => {
>             console.log("like clicked");
>             setFeedback(UserFeedback.Positive);
>           }}
>           onDislike={async () => {
>             console.log("dislike clicked");
>             setFeedback(UserFeedback.Negative);
>           }}
>           onFlag={async () => console.log("flag clicked")}
>           onPlay={async () => console.log("play clicked")}
>           currentFeedback={feedback}
>         />
>       </Card>
>     </Flex>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ### Basic Usage
>
> Message action toolbar:
>
> ```tsx theme={null}
> import { Toolbox, UserFeedback } from "@servicetitan/anvil2-ext-atlas";
>
> function MessageToolbox() {
>   const [feedback, setFeedback] = useState(UserFeedback.None);
>
>   return (
>     <Toolbox
>       text="Message content to copy"
>       currentFeedback={feedback}
>       onLike={async () => {
>         await submitFeedback("positive");
>         setFeedback(UserFeedback.Positive);
>       }}
>       onDislike={async () => {
>         await submitFeedback("negative");
>         setFeedback(UserFeedback.Negative);
>       }}
>       onRetry={async () => {
>         await regenerateResponse();
>       }}
>     />
>   );
> }
> ```
>
> ### With All Actions
>
> Include all available actions:
>
> ```tsx theme={null}
> import { Toolbox, UserFeedback } from "@servicetitan/anvil2-ext-atlas";
>
> function FullToolbox() {
>   return (
>     <Toolbox
>       text="Message content"
>       currentFeedback={UserFeedback.None}
>       onLike={handleLike}
>       onDislike={handleDislike}
>       onRetry={handleRetry}
>       onFlag={handleFlag}
>       onPlay={handlePlay}
>     />
>   );
> }
> ```
>
> ### Copy Only
>
> Simple copy functionality:
>
> ```tsx theme={null}
> import { Toolbox } from "@servicetitan/anvil2-ext-atlas";
>
> function CopyOnlyToolbox() {
>   return <Toolbox text="Content to copy" />;
> }
> ```

> [tab] Toolbox API
>
> ```tsx theme={null}
> <Toolbox
>   text="Message content"
>   currentFeedback={UserFeedback.None}
>   onRetry={handleRetry}
>   onLike={handleLike}
>   onDislike={handleDislike}
>   onFlag={handleFlag}
>   onPlay={handlePlay}
> />
> ```
>
> ## `Toolbox` Props
>
> **currentFeedback** `UserFeedback`
>
> Current feedback state: `None`, `Positive`, or `Negative`. Affects which buttons are shown.
>
> **onDislike** `() =\> Promise\<void\>`
>
> Async callback for dislike button. Button only renders when provided.
>
> **onFlag** `() =\> Promise\<void\>`
>
> Async callback for flag button. Button only renders when provided.
>
> **onLike** `() =\> Promise\<void\>`
>
> Async callback for like button. Button only renders when provided.
>
> **onPlay** `() =\> Promise\<void\>`
>
> Async callback for play audio button. Button only renders when provided.
>
> **onRetry** `() =\> Promise\<void\>`
>
> Async callback for retry button. Button only renders when provided.
>
> **text** `string`
>
> The text content to copy when the copy button is clicked.
>
> ## UserFeedback Enum
>
> ```tsx theme={null}
> enum UserFeedback {
>   None = "None",
>   Positive = "Positive",
>   Negative = "Negative",
> }
> ```


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