Alert Dialog
Alert dialogs can be used for confirmations, warnings, informational messages and more.
Options
Option | Type | Required | Default | Description |
---|---|---|---|---|
header | string | No* | nil | The dialog header text (supports markdown) |
content | string | No* | nil | The main content text (supports markdown) |
icon | string | No | nil | FontAwesome icon class |
iconColor | string | No | '#71717A' | Icon color (hex or CSS color name) |
labels | table | No | {} | Button labels: { cancel = 'Cancel', confirm = 'Confirm' } |
type | string | No | 'default' | Dialog type: 'default' , 'info' , 'success' , 'warning' , 'error' |
size | string | No | 'md' | Dialog size: 'xs' , 'sm' , 'md' , 'lg' , 'xl' |
cancel | boolean | No | true | Whether to show cancel button |
callouts | table | No | nil | Array of callout objects (see below) |
*Either header
or content
is required.
Callouts
Callouts are optional styled information boxes that can be added to alert dialogs to highlight important information.
Option | Type | Required | Default | Description |
---|---|---|---|---|
label | string | No | nil | The callout title/header (supports markdown) |
description | string | Yes | nil | The callout content text (supports markdown) |
type | string | No | 'info' | Callout type: 'info' , 'success' , 'warning' , 'error' |
icon | string | No | nil | Custom FontAwesome icon (inherits type color) |
Return Values
'confirm'
- User clicked confirm'cancel'
- User clicked cancel or closed dialog
Example
local alert = exports.lation_ui:alert({
header = 'Delete Item',
content = 'Are you sure you want to delete this item?',
icon = 'fas fa-trash',
iconColor = '#EF4444',
type = 'destructive',
})
if alert == 'confirm' then
print('Item deleted!')
end
local alert = exports.lation_ui:alert({
header = 'Callouts',
content = 'Below is a showcase of a new optional element inside alert dialogs - callouts! Make important information stand out like never before.',
icon = 'fas fa-star',
callouts = {
{
label = 'Warning',
description = 'This is the warning type callout',
type = 'warning'
},
{
label = 'Success',
description = 'This is the success type callout',
type = 'success'
},
{
label = 'Error',
description = 'THis is the error type callout',
type = 'error'
},
{
label = 'Customizable',
description = 'THis callout uses a custom icon but inherits the default type settings',
icon = 'fas fa-rocket'
}
}
})