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', 'success', 'destructive'
optionstableYes{}Array of input fields

Field Options

OptionTypeRequiredDefaultDescription
typestringYesnilField type: 'input', 'number', 'toggle', 'checkbox', 'select', 'multi-select', 'slider', 'textarea', 'color'
labelstringYesnilField label
descriptionstringNonilField description
placeholderstringNonilPlaceholder text (input, textarea, color)
iconstringNonilFontAwesome icon class
iconColorstringNo'#71717A'Icon color (hex)
requiredbooleanNofalseWhether field is required
disabledbooleanNofalseWhether field is disabled
passwordbooleanNofalsePassword field with toggle visibility (input type only)
minnumberNonilMin value (number, slider) or min length (input, textarea)
maxnumberNonilMax value (number, slider), max length (input, textarea), or max selections (multi-select)
stepnumberNo1Step value (number, slider)
unitstringNonilUnit label (slider)
optionstableNo{}Options for select/multi-select
defaultanyNonilDefault field value
checkedbooleanNonilAlias for default on toggle/checkbox types
formatstringNo'hex'Color format for color picker: 'hex', 'hexa', 'rgb', 'rgba', 'hsl', 'hsla'
searchablebooleanNotrueEnable search functionality (select, multi-select)

Notes:

  • 'checkbox' is an alias for 'toggle' - both render the same component.
  • 'checked' is an alias for 'default' on toggle/checkbox types.

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