⚙️ Modern UIComponentsAlert Dialog

Alert Dialog

Alert dialogs can be used for confirmations, warnings, informational messages and more.

Options

OptionTypeRequiredDefaultDescription
headerstringNo*nilThe dialog header text (supports markdown)
contentstringNo*nilThe main content text (supports markdown)
iconstringNonilFontAwesome icon class
iconColorstringNo'#71717A'Icon color (hex or CSS color name)
labelstableNo{}Button labels: { cancel = 'Cancel', confirm = 'Confirm' }
typestringNo'default'Dialog type: 'default', 'info', 'success', 'warning', 'error'
sizestringNo'md'Dialog size: 'xs', 'sm', 'md', 'lg', 'xl'
cancelbooleanNotrueWhether to show cancel button
calloutstableNonilArray 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.

OptionTypeRequiredDefaultDescription
labelstringNonilThe callout title/header (supports markdown)
descriptionstringYesnilThe callout content text (supports markdown)
typestringNo'info'Callout type: 'info', 'success', 'warning', 'error'
iconstringNonilCustom 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'
        }
    }
})