Alert
The Alert component displays contextual messages in the user interface: notifications, warnings, confirmations or errors. It can be styled in several variants, states and densities, and is easily integrated using Snippets to enrich its content.
Inform your users of the status of an action or page in your application. It supports states such as info, warning, error, or success to highlight the type of information you want to convey.
This is the minimal version of an alert. It contains simple text and adopts the default styles (variant filled, density default, neutral state).
Inform your users of the status of an action or page in your application. It supports states such as info, warning, error, or success to highlight the type of information you want to convey.
The alert can adopt different visual styles via the prop variant:
These variants can be adapted to different visual contexts or levels of importance.
An alert with no background
An alert with an outline
An alert with a dashed border
For greater expressiveness, an alert can be marked by a status: info
, success
, warning
, error
.
Each state applies a color and a contextual icon to convey the right signal to the user.
A success-style alert
A success-style alert
A warning-style alert
A warning-style alert
An error-style alert
An error-style alert
An info-style alert
An info-style alert
Prop density lets you control the vertical size of the alert:
Ideal for adapting alerts to different levels of hierarchy or UI density.
This is a compact alert, with reduced margins and padding
This is a basic options alert
This is a comfortable alert, margins and padding are increased
The prepend, append and close snippets are used to add custom content:
These snippets enable you to compose rich alerts without sacrificing structure.
prepend
children
append
Add the closable prop to allow the user to close the alert manually. A close button is automatically displayed, unless overridden by the close slot.
With this alert system, you can display them optionally. The closable action lets your users hide the alert once they've viewed it.
To enhance your Alerts, think of Icon for legibility, or Button for integrated actions.