Alert Dialog
Simple confirmation dialogs with confirm and cancel actions.
Client Exports
alertDialog
Opens a confirmation dialog and returns the user’s choice. This is an awaitable export.
local result = exports['trinity-ui']:alertDialog(data)Parameters:
| Property | Type | Default | Description |
|---|---|---|---|
title | string | — | Dialog title |
message | string | — | Dialog message (alias: content) |
icon | string | — | Iconify icon name |
confirmText | string | 'Confirm' | Confirm button label |
cancelText | string | 'Cancel' | Cancel button label |
Returns: 'confirm' | 'cancel' | 'closed'
closeAlertDialog
Programmatically close an open alert dialog.
exports['trinity-ui']:closeAlertDialog(reason)| Parameter | Type | Default | Description |
|---|---|---|---|
reason | string | 'closed' | Reason string returned to the awaiting call |
Example
local result = exports['trinity-ui']:alertDialog({
title = 'Confirm Purchase',
message = 'Are you sure you want to buy this item for $500?',
icon = 'fa6-solid:cart-shopping',
confirmText = 'Buy',
cancelText = 'Nevermind'
})
if result == 'confirm' then
print('Item purchased!')
elseif result == 'cancel' then
print('Purchase cancelled.')
endLast updated on