Skip to main content

Common Examples

import { Alert } from "@servicetitan/anvil2";

function ExampleComponent() {
  return (
    <Alert status="warning" title="Warning!">
      This is a warning message.
    </Alert>
  );
}

Alert statuses

Use the status prop to set the color and icon of the Alert.

Closable alerts

Make an alert closable by providing a value to the onClose prop.

Alerts with actions

It is common to use Anvil2 Buttons within alerts to create actions. These can easily be arranged using the Flex component.
Last modified on January 23, 2026