Input Dialog

Input dialogs provide forms with various field types for collecting user data.

Dialog Options

OptionTypeRequiredDefaultDescription
titlestringNonilDialog title
subtitlestringNonilDialog subtitle
submitTextstringNo'Submit'Submit button text
cancelTextstringNo'Cancel'Cancel button text
typestringNo'default'Dialog type: 'default', 'info', 'success', 'warning', 'error'
optionstableYes{}Array of input fields

Field Options

OptionTypeRequiredDefaultDescription
typestringYesnilField type: 'input', 'number', 'toggle', 'checkbox', 'select', 'multi-select', 'slider', 'textarea', 'color', 'date', 'date-range'
labelstringYesnilField label
descriptionstringNonilField description
placeholderstringNonilPlaceholder text (input, textarea, color, date, date-range)
iconstringNonilFontAwesome icon class
iconColorstringNo'#71717A'Icon color (hex or CSS color name)
requiredbooleanNofalseWhether field is required
disabledbooleanNofalseWhether field is disabled
passwordbooleanNofalsePassword field with toggle visibility (input type only)
minstring/numberNonilMin value (number, slider), min length (input, textarea), or min date for date/date-range picker (must match format)
maxstring/numberNonilMax value (number, slider), max length (input, textarea), max selections (multi-select), or max date for date/date-range picker (must match format)
stepnumberNo1Step value (number, slider)
unitstringNonilUnit label (slider)
optionstableNo{}Options for select/multi-select (see Select Options)
defaultanyNonilDefault field value
checkedbooleanNonilAlias for default on toggle/checkbox types
formatstringNo'hex' / 'MM/dd/yyyy'Color format for color picker: 'hex', 'hexa', 'rgb', 'rgba', 'hsl', 'hsla' or date format for date/date-range picker: 'MM/dd/yyyy', 'dd/MM/yyyy', 'yyyy-MM-dd', 'dd.MM.yyyy'
clearablebooleanNotrueWhether date/date-range picker shows clear button
searchablebooleanNotrueEnable search functionality (select, multi-select)

Select Options

For select and multi-select field types, the options parameter accepts an array of option objects:

OptionTypeRequiredDefaultDescription
labelstringNonilDisplay text for the option (uses value if not provided)
valueanyYesnilValue returned when option is selected
disablebooleanNofalseWhether the option is disabled and cannot be selected

Notes:

  • 'checkbox' is an alias for 'toggle' - both render the same component.
  • 'checked' is an alias for 'default' on toggle/checkbox types.
  • For 'date' type fields, min, max, and default values must match the specified format.
  • For 'date-range' type fields, default can be used to set a default date range default = { "01/01/2025", "01/07/2025" }.

Return Values

  • Table of values (indexed by field order) or nil if cancelled

Example

local result = exports.lation_ui:input({
    title = "User Profile",
    subtitle = "Enter your information",
    submitText = "Save",
    options = {
        {
            type = 'input',
            label = 'Username',
            description = 'Input your username below',
            placeholder = 'IamLation',
            icon = 'fas fa-user',
            required = true
        },
        {
            type = 'number',
            label = 'Age',
            description = 'Input your age below',
            icon = 'fas fa-birthday-cake',
            required = true,
            default = 18
        },
        {
            type = 'select',
            label = 'Country',
            description = 'Select your country',
            icon = 'fas fa-globe',
            options = {
                { label = 'United States', value = 'us' },
                { label = 'Canada', value = 'ca' },
                { label = 'United Kingdom', value = 'uk' },
                { label = 'Australia', value = 'au' }
            }
        },
        {
            type = 'toggle',
            label = 'Receive Notifications',
            description = 'Toggle notifications on or off',
            icon = 'fas fa-bell',
            default = true
        },
        {
            type = 'slider',
            label = 'Volume',
            description = 'Adjust the volume level',
            icon = 'fas fa-volume-up',
            min = 0,
            max = 100,
            unit = '%',
            default = 50
        }
    }
})
 
if result then
    print('Username:', result[1])
    print('Age:', result[2])
    print('Country:', result[3])
    print('Notifications:', result[4])
    print('Volume:', result[5])
end