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

# Error Message – Code

> ErrorMessage displays error states with optional retry functionality.

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

> [tab] Implementation
>
> ext-atlas-error-message-demo
>
> [StackBlitz demo](https://stackblitz.com/github/servicetitan/anvil2-docs-live-code/tree/main/examples/ext-atlas-error-message-demo?file=src/App.tsx)
>
> ```tsx lines expandable theme={null}
> import { ErrorMessage } 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">
>           With Error String
>         </Text>
>         <ErrorMessage
>           error="Failed to load response"
>           message="Previous message content"
>           onRetry={() => console.log("retry clicked")}
>         />
>       </Card>
>
>       <Card flexDirection="column" gap={2} background="strong">
>         <Text size="medium" variant="eyebrow">
>           With Error Boolean
>         </Text>
>         <ErrorMessage
>           error={true}
>           message="An error occurred while processing your request"
>           onRetry={() => console.log("retry clicked")}
>         />
>       </Card>
>     </Flex>
>   );
> }
>
> export default App;
> ```
>
> ## Common Examples
>
> ### Basic Usage
>
> Standalone error display:
>
> ```tsx theme={null}
> import { ErrorMessage } from "@servicetitan/anvil2-ext-atlas";
>
> function ErrorMessageExample() {
>   return (
>     <ErrorMessage
>       error="Unable to process your request"
>       onRetry={() => retryRequest()}
>     />
>   );
> }
> ```
>
> ### With Fallback Message
>
> Use boolean error with fallback message:
>
> ```tsx theme={null}
> import { ErrorMessage } from "@servicetitan/anvil2-ext-atlas";
>
> function ErrorMessageFallback() {
>   return (
>     <ErrorMessage
>       error={true}
>       message="Something went wrong. Please try again."
>       onRetry={() => retryRequest()}
>     />
>   );
> }
> ```
>
> ### Without Retry
>
> Error display without retry option:
>
> ```tsx theme={null}
> import { ErrorMessage } from "@servicetitan/anvil2-ext-atlas";
>
> function ErrorMessageNoRetry() {
>   return (
>     <ErrorMessage error="This action cannot be completed at this time." />
>   );
> }
> ```

> [tab] ErrorMessage API
>
> ```tsx theme={null}
> <ErrorMessage
>   error="Something went wrong"
>   message="Fallback message"
>   onRetry={handleRetry}
> />
> ```
>
> ## `ErrorMessage` Props
>
> **error** `string | boolean` *required*
>
> The error message to display. If boolean `true`, uses `message` prop instead.
>
> **className** `string`
>
> Additional CSS class name for custom styling.
>
> **message** `string`
>
> Fallback message to display when `error` is `true`.
>
> **onRetry** `() =\> void`
>
> Callback for retry button. Button only renders when provided.


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