Alert
A message that stays on the page, with an optional icon.
Invoices are sent at 9:00
Change the send time in your workspace settings.
When to use
- Use when
- A message about the page or task that should stay visible, such as a warning or a status.
- Avoid when
- The message is a response to an action and can go away on its own; use Toast.
Installation
The source lands in src/components/ui/alert.tsx, along with any Shelf items it builds on, and .shelf/lock.json records what was installed. It's yours to edit.
Usage
Examples
Destructive
For errors and anything that needs attention now.
Payment failed
Update your card to keep your plan.
Built on
- Packages
@stylexjs/stylex- Shelf items
foundations,utils- Figma
- Optional native Figma library. See Designers.
Verified
- Size
- 1.1 kB gzipped on its own, 2.8 kB with the Shelf items and packages it builds on. JS and CSS in a production build, without React.
- Accessibility
- Axe passes on 2 stories
- Behavior
- 2 interaction tests in Storybook
- React Doctor
- React Doctor finds nothing