Skip to main content

Common Examples

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.Unlike Dialog, Drawer, and Popover, Alert does not have an open prop. Show and hide the alert by conditionally rendering it. In onClose, update your state and stop rendering the Alert (for example {isOpen ? <Alert ... /> : null}).

Alerts with actions

It is common to use Anvil2 Buttons within alerts to create actions. These can easily be arranged using the Flex component.

AI Mark

Add an AI Mark inline after the alert title by passing aiMark. Use true for the sparkle only, or pass tooltip or popover configuration.
Last modified on October 13, 2026