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

# Suggestion – Code

> Suggestion and SuggestionList display clickable suggestion chips for common prompts.

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

> [tab] Implementation
>
> ext-atlas-suggestion-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-suggestion-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { Suggestion, SuggestionList } from "@servicetitan/anvil2-ext-atlas";
> import { Card, Flex, Text } from "@servicetitan/anvil2";
>
> function App() {
>   return (
>     <Flex direction="column" gap={4} style={{ width: "388px" }}>
>       <Card flexDirection="column" gap={2} background="strong">
>         <Text size="medium" variant="eyebrow">
>           Single Suggestion
>         </Text>
>         <Suggestion
>           text="What can you help me with?"
>           onClick={() => console.log("suggestion clicked")}
>         />
>       </Card>
>
>       <Card flexDirection="column" gap={2} background="strong">
>         <Text size="medium" variant="eyebrow">
>           Suggestion List
>         </Text>
>         <SuggestionList
>           suggestions={[
>             "What can you help me with?",
>             "Order more",
>             "Show me recent updates",
>           ]}
>           onSelect={(suggestion) => console.log("selected:", suggestion)}
>         />
>       </Card>
>     </Flex>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ### Single Suggestion
>
> Display a single suggestion chip:
>
> ```tsx theme={null}
> import { Suggestion } from "@servicetitan/anvil2-ext-atlas";
>
> function SingleSuggestion() {
>   return (
>     <Suggestion
>       text="How do I schedule an appointment?"
>       onClick={(text) => sendMessage(text)}
>     />
>   );
> }
> ```
>
> ### Suggestion List
>
> Display multiple suggestions:
>
> ```tsx theme={null}
> import { SuggestionList } from "@servicetitan/anvil2-ext-atlas";
>
> function MultipleSuggestions() {
>   const suggestions = [
>     "How do I schedule an appointment?",
>     "What are your business hours?",
>     "Tell me about your services",
>   ];
>
>   return (
>     <SuggestionList
>       suggestions={suggestions}
>       onSelect={(text) => sendMessage(text)}
>     />
>   );
> }
> ```
>
> ### Dynamic Suggestions
>
> Update suggestions based on context:
>
> ```tsx theme={null}
> import { SuggestionList } from "@servicetitan/anvil2-ext-atlas";
>
> function ContextualSuggestions({ topic }) {
>   const suggestions = useMemo(() => {
>     if (topic === "scheduling") {
>       return ["Book now", "See availability", "Reschedule"];
>     }
>     return ["Get started", "Learn more", "Contact us"];
>   }, [topic]);
>
>   return (
>     <SuggestionList
>       suggestions={suggestions}
>       onSelect={handleSelect}
>     />
>   );
> }
> ```

> [tab] Suggestion API
>
> ```tsx theme={null}
> <Suggestion
>   text="How do I schedule?"
>   onClick={handleClick}
> />
> ```
>
> ## `Suggestion` Props
>
> **onClick** `(suggestion: string) =\> void` *required*
>
> Callback fired when the suggestion is clicked, receives the suggestion text.
>
> **text** `string` *required*
>
> The suggestion text to display and pass to the onClick callback.

> [tab] SuggestionList API
>
> ```tsx theme={null}
> <SuggestionList
>   suggestions={["Option 1", "Option 2"]}
>   onSelect={handleSelect}
> />
> ```
>
> ## `SuggestionList` Props
>
> **onSelect** `(text: string) =\> void` *required*
>
> Callback fired when a suggestion is selected.
>
> **suggestions** `string[]` *required*
>
> Array of suggestion strings to display.


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