Alert
Presentational alert with the shared tones (neutral, info, success, warning, destructive), a trailing action slot, long text that wraps, and an opt-in live role.
Example
Builds are queued
Three builds run ahead of yours.
Deployed
Apollo is live on the production domain.
Deploy failed
The build exited with code 1. See the log.
alert-demo.tsxCopy code
Installation
Copy code
Brings alongtone
npm packages
class-variance-authority@0.7.1Usage
ImportCopy code
API reference
Alert
| Prop | Type | Default |
|---|---|---|
tone | AlertTone | – |
actionA trailing control, like a Button. It sits beside the text, and below it when the alert is narrower than 28rem. | ReactNode | – |
liveMakes it a live region for messages that appear after the page loads: `role="alert"` for warning and destructive tones, which interrupts a screen reader, `role="status"` otherwise. Off by default. | boolean | – |
announce@deprecated Use `live`. Always `role="alert"`, whatever the tone. | boolean | – |
Also takes <div> attributes and render.
AlertTitle
Takes <div> attributes and render.
AlertDescription
Takes <div> attributes and render.
Other exports
alertVariantstype AlertPropstype AlertToneAccessibility
- Not a live region unless you pass live: then role=alert for warning and destructive, role=status otherwise.
- The icon stays out of the text column and is hidden from assistive technology.
Agent actions
Runs agent.snapshot() from @ui-sdk/react/agent on the live preview above.