Accessibility tip (Web only)
Alerts require an accessibility label, which we set to title
by default. However, if there's other text that gives the user better context to the alert, then you can pass an element id to accessibilityLabelledBy
. Alternatively, you may directly provide a contextual label to accessibilityLabel
.
Default Alert
Controlled using visible
and onRequestClose
.
Loading...
Portal Alert
Controlled programmatically using the useAlert
hook.
Warning
Deprecated: Inserting JSX into the DOM using a function in an event handler is an anti-pattern. This hook will be removed in future version. Use the visible
and onRequestClose
props instead
Loading...
Alert over Modal
Alert displays on top of a Modal
. You must pass stacked as a prop to Alert
when it is used inside of a Modal
.
Loading...