Files
Basalt2/docs/references/elements/Dialog.md
2025-10-30 13:13:21 +00:00

2.0 KiB

Dialog

A dialog overlay system that provides common dialog types such as alert, confirm, and prompt.

Extends: Frame

Properties

Property Type Default Description
title string "" The dialog title
primaryColor color lime Primary button color (OK, confirm actions)
secondaryColor color lightGray Secondary button color (Cancel, dismiss actions)
buttonForeground color black Foreground color for buttons
modal boolean true If true, blocks all events outside the dialog

Functions

Method Returns Description
Dialog:show Dialog Shows the dialog
Dialog:close Dialog Closes the dialog
Dialog:alert Dialog Creates a simple alert dialog
Dialog:confirm Dialog Creates a confirm dialog
Dialog:prompt Dialog Creates a prompt dialog with input

Dialog:show()

Shows the dialog

Returns

  • Dialog self The Dialog instance

Dialog:close()

Closes the dialog

Returns

  • Dialog self The Dialog instance

Dialog:alert(title, message, callback?)

Creates a simple alert dialog

Parameters

  • title string The alert title
  • message string The alert message
  • callback (optional) function Callback when OK is clicked

Returns

  • Dialog self The Dialog instance

Dialog:confirm(title, message, callback)

Creates a confirm dialog

Parameters

  • title string The dialog title
  • message string The confirmation message
  • callback function Callback (receives boolean result)

Returns

  • Dialog self The Dialog instance

Dialog:prompt(title, message, default?, callback?)

Creates a prompt dialog with input

Parameters

  • title string The dialog title
  • message string The prompt message
  • default (optional) string Default input value
  • callback (optional) function Callback (receives input text or nil if cancelled)

Returns

  • Dialog self The Dialog instance