⚙️ Modern UIComponentsAlert Dialog

Alert Dialog

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

Options

OptionTypeRequiredDefaultDescription
headerstringNo*nilThe dialog header text
contentstringNo*nilThe main content text
iconstringNonilFontAwesome icon class
iconColorstringNo'#71717A'Icon color (hex)
labelstableNo{}Button labels: { cancel = 'Cancel', confirm = 'Confirm' }
typestringNo'default'Dialog type: 'default', 'success', 'destructive'
sizestringNo'md'Dialog size: 'xs', 'sm', 'md', 'lg'
cancelbooleanNotrueWhether to show cancel button

*Either header or content is required.

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