MazAlert
MazAlert is an accessible component for displaying contextual feedback messages like success, warning, error, or informational notifications with customizable colors, icons, and styling options
Before use it, you should install the MazUi plugin in your project, follow instructions in Getting Started
Basic usage
Information
Variants
MazAlert supports two visual variants: soft (default) with transparent background, and solid with full color background.
Soft variant (default)
The soft variant uses a transparent background with colored text.
Soft Info
Soft Success
Soft Error
Solid variant
The solid variant uses the full color as background with contrasting text.
Solid Info
Solid Success
Solid Error
All colors with solid variant
Info
Success
Warning
Destructive
Primary
Secondary
Accent
Contrast
Colors
MazAlert supports all theme colors to convey different types of messages.
Info
Success
Warning
Destructive
Primary
Secondary
Accent
Contrast
With slots
Use slots for more complex content with custom HTML.
3 errors found
- firstname - Invalid length: Expected >=5 but received 0
- lastname - Invalid length: Expected >=2 but received 0
- age - Invalid type: Expected number but received ""
Without border
Remove the border with :bordered="false".
Without border
With border (default)
Rounded sizes
Customize the border radius with the rounded-size prop.
Rounded: none
Rounded: sm
Rounded: md
Rounded: base
Rounded: lg
Rounded: xl
Rounded: 2xl
Rounded: 3xl
Hide icon
Hide the default icon with hide-icon.
With icon (default)
Without icon
Custom icon
Provide a custom icon using the icon prop.
Custom icon
Title only or content only
You can use either title, content, or both.
Title only alert
Both title and content
Use cases
Form validation errors
Please fix the following errors:
- Email address is required
- Password must be at least 8 characters
Success notification
Payment successful!
Warning message
Session expiring soon
Props
| Name | Description | Type | Required | Default | Possible values |
|---|---|---|---|---|---|
| title | Title of the alert | string | No | undefined | - |
| content | Content of the alert | string | No | undefined | - |
| icon | Icon of the alert - can be a component or icon name string | IconComponent | string | No | undefined | - |
| hide-icon | Hide the icon | boolean | No | false | - |
| color | Color of the alert | MazAlertColor | No | info | 'success' | 'warning' | 'destructive' | 'info' | 'primary' | 'secondary' | 'accent' | 'contrast' |
| icon-size | Size of the icon | MazIconProps['size'] | No | md | - |
| rounded-size | Size of the rounded corners | MazAlertRoundedSize | No | base | 'none' | 'sm' | 'md' | 'base' | 'lg' | 'xl' | '2xl' | '3xl' |
| bordered | Add border to the component | boolean | No | true | - |
| variant | Visual variant of the alert | MazAlertVariant | No | soft | 'soft' | 'solid' |
Slots
| Name | Description | Bindings |
|---|---|---|
| title | Title slot - overrides title prop | |
| default | Default slot for alert content - overrides content prop |