Usage
The Alert component is utilized to draw the attention of the user. The Alert is commonly utilized to display informational message throughout the Portal for tips, warnings, or other contextual information.
Each Alert instance is pre-configured with styles based on the default appearance
value, and can be customized per-instance, or wrapped in a Snippet for easy reusability.
::alert
---
appearance: "success"
show-icon: true
title: "Attention please"
message: "Alerts are easy to use!"
---
::
Props
appearance
The Alert component can take 1 of 5 appearance values to change its overall theming:
- Type:
'info' | 'success' | 'warning' | 'danger'
- Default:
'info'
::alert
---
message: "You can change the theme by updating the appearance."
appearance: "info"
---
::
title
Optionally provide an Alert title to display above the message content.
- Type:
string
- Default:
''
::alert
---
appearance: "success"
message: "This alert even has a title above the message."
title: "Look Here!"
---
::
message
The Alert message text.
If providing message content other than plain text such as formatted markdown, you should utilize the default slot to provide the message content.
- Type:
string
- Default:
''
::alert
---
appearance: "success"
message: "You can use plain text in the message prop. For markdown and other content, use the default slot."
---
::
showIcon
Each Alert appearance comes with a corresponding default icon. Set this prop to true
in order to display the icon.
You can also provide a custom icon through the icon slot.
- Type:
boolean
- Default:
false
::alert
---
message: "You can display an icon to the left."
show-icon: true
appearance: "success"
---
::
Shared Props
This component also includes the shared props listed below:
background
- default isnull
backgroundColor
- default isnull
border
- default isnull
borderRadius
- default isnull
color
- default isnull
margin
- default is20px 0
padding
- default isnull
styles
- default is''
See here for more information on shared props.
Slots
default
Use the #default
slot to add alert message content such as formatted markdown. When the slot content is provided, it takes precedence over the message prop.
icon
Provide a custom icon to display to the left of the Alert message.