- Implementation
- Alert Props
Common Examples
Alert statuses
Use thestatus prop to set the color and icon of the Alert.Closable alerts
Make an alert closable by providing a value to theonClose 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 passingaiMark. Use true for the sparkle only, or pass tooltip or popover configuration.