Alert
Basic Usage
The openAlert function allows you to display alert messages dynamically with ease. Simply call openAlert with the desired options to customize the alert's type, position, size, and other properties.
Types
The type property specifies the type of the alert. Available options are:
success(green, for successful operations)warning(yellow, for warnings)info(blue, for informational messages)error(red, for errors)neutral(default, for general notifications)
Positioning
Control where the alert appears on the screen using the position property. Available positions include:
top, bottom, left, right, center, top-right, top-left, bottom-right and bottom-left
Duration
Specify how long the alert will be displayed using the displayTime property. The value should be in milliseconds.
If displayTime is not provided, the alert will remain visible until it is manually closed.
Close Button
Add a close button to the alert by setting the closeButton property to true. If displayTime is set to 0, the close button is enabled by default.
Adding HTML Content
You can include HTML content in the subtitle property for more complex layouts.
Size
Control the alert's size using the size property. Available sizes include:
xs, sm, md, lg, xl, 2xl (default), 3xl, 4xl, 5xl, 6xl, 7xl
Disabling Animations
Disable animations by setting the notAnimate property to true.
Custom Styles
Customize the alert's appearance using the class property to apply custom CSS classes.
Example with All Features
Here’s a comprehensive example using multiple features together: