Quick start guide and documentation
Native browser alert(), confirm(), and prompt() functions are:
RSL Alert Dialogs provide modern, fully-styled, accessible alternatives with animations, custom colors, and promise-based async/await support.
rslAlert({
title: 'Success!',
message: 'Your changes have been saved.',
type: 'success',
animation: 'zoom-in'
});
Show a message with an OK button (replaces alert())
rslAlert({
title: 'Welcome!',
message: 'Thanks for visiting our site.',
type: 'info', // info, success, warning, danger
animation: 'zoom-in', // zoom-in, fade-in, slide-down, slide-up
position: 'center' // center, top, bottom
});
Ask user to confirm or cancel an action (replaces confirm())
rslConfirm({
title: 'Delete Item?',
message: 'This action cannot be undone.',
type: 'warning',
animation: 'slide-down'
}).then(confirmed => {
if (confirmed) {
// User clicked Yes
deleteItem();
}
});
Collect text input from user (replaces prompt())
rslPrompt({
title: 'Enter Your Name',
message: 'Please provide your full name:',
placeholder: 'John Doe',
type: 'info',
animation: 'fade-in'
}).then(value => {
if (value !== null) {
// User submitted (value is the input text)
console.log('Name:', value);
}
// null means user cancelled
});
| Option | Values | Default |
|---|---|---|
title | String - dialog heading | Required |
message | String - dialog content | Required |
type | 'info', 'success', 'warning', 'danger' | 'info' |
animation | 'zoom-in', 'fade-in', 'slide-down', 'slide-up' | 'zoom-in' |
position | 'center', 'top', 'bottom' | 'center' |
| Returns | Description |
|---|---|
true | User clicked Yes/Confirm |
false | User clicked No/Cancel or pressed Esc |
| Option | Description |
|---|---|
placeholder | Placeholder text for input field |
defaultValue | Pre-filled value in input field |
Returns string | User's input text when submitted |
Returns null | User cancelled or pressed Esc |
You can also trigger alerts from HTML buttons using data attributes:
async/await with confirm dialogs for cleaner code flowtype to action severity: info (neutral), success (positive), warning (caution), danger (destructive)position: 'top' for non-blocking notifications, 'center' for important decisionsRSL Alert Dialogs include accessibility features:
role="dialog" and aria-labelledby for screen readers