Appearance
Alerts - AvAlert
✨ Introduction
The AvAlert component is intended for use in the AvToaster component.
Alerts draw the user attention to information without interrupting their current task.
The alert is available in two sizes:
- medium size (MD, by default, if the
smallprop is absent or set tofalse) and - small size (SM) if the
smallprop is set totrue.
🏗️ Structure
The alert consists of the following elements:
- a title (prop
title, of typestring):- optional on the MD version (if the
smallprop is absent or set tofalse), - hidden on the SM version (if the
smallprop is set totrue).
- optional on the MD version (if the
- an icon and a color determined by the
typeprop, which can be one of the following strings:info(default value if thetypeprop is absent)successwarningerror
- a description text (with the
descriptionprop, of typestring):- optional on the MD version
- mandatory on the SM version
- the default
slotcan be used as a description
- a closing cross if the
closeableprop is set totrue
Other props:
closedis used to indicate whether the alert should be present (false) or not (true) in the DOM.closeButtonLabelspecifies the label and aria-label of the alert close button. By default, the value isClose.
🏷️ Props
| Name | Type | Default | Mandatory | Description |
|---|---|---|---|---|
id | string | alert-${crypto.randomUUID()} | The alert ID. | |
type | 'info' | 'success' | 'warning' | 'error' | 'info' | The alert type influences its color and associated icon. | |
title | string | '' | The alert title. | |
description | string | undefined | The alert description text. | |
small | boolean | false | Indicates whether the alert should be MD (false) or SM (true) in version. | |
closed | boolean | false | Indicates whether the alert should be present (false) or not (true) in the DOM. | |
closeable | boolean | false | Indicates whether the close button should be present (true) or not (false) in the alert. | |
closeButtonLabel | string | 'Close' | The label and aria-label of the alert close button. | |
alert | boolean | false | Indicates whether the alert should have the alert role (true) or not (false). |
🔊 Events
| Name | Data (payload) | Description |
|---|---|---|
'close' | Event triggered when the alert is closed. |
🎨 Slots
| Name | Description |
|---|---|
default | Default slot for alert description. |
