Skip to Content

Input Dialog

Display a dialog with multiple input fields for collecting player data.

Exports

ExportParametersReturns
InputDialog(heading, rows, options)table or nil — Array of input values, or nil if cancelled
CloseInputDialog()—

InputDialog Parameters

ParameterTypeRequiredDescription
headingstringYesDialog title
rowstableYesArray of row definitions
optionstableNoAdditional options

Options

FieldTypeDescription
allowCancelbooleanWhether the dialog can be cancelled (default: true)
sizestringModal size: 'xs', 'sm', 'md', 'lg', 'xl'
labels.cancelstringCustom cancel button text
labels.confirmstringCustom confirm button text

Row Types

input — Text Input

FieldTypeDescription
labelstringField label
descriptionstringHelp text below the label
iconstringIcon inside the input
placeholderstringPlaceholder text
defaultstringDefault value
requiredbooleanMark as required
disabledbooleanDisable the field
passwordbooleanHide input as password
minnumberMinimum character length
maxnumberMaximum character length

number — Number Input

FieldTypeDescription
labelstringField label
descriptionstringHelp text below the label
iconstringIcon inside the input
defaultnumberDefault value
minnumberMinimum value
maxnumberMaximum value
stepnumberStep increment
precisionnumberDecimal places
requiredbooleanMark as required
disabledbooleanDisable the field

select / multi-select — Dropdown

FieldTypeDescription
labelstringField label
descriptionstringHelp text below the label
iconstringIcon inside the input
optionstableArray of options (see below)
defaultstring or tableDefault selected value(s)
requiredbooleanMark as required
disabledbooleanDisable the field
clearablebooleanShow a clear button
searchablebooleanEnable search in dropdown
maxSelectedValuesnumberLimit selections (multi-select)

Option Fields

FieldTypeDescription
valuestringOption value returned on submit
labelstringDisplay text
descriptionstringDescription shown below the label in the dropdown
iconstringFontAwesome icon shown next to the option

slider — Range Slider

FieldTypeDescription
labelstringField label
descriptionstringHelp text below the label
defaultnumberDefault value
minnumberMinimum value
maxnumberMaximum value
stepnumberStep increment
requiredbooleanMark as required
disabledbooleanDisable the field

checkbox — Checkbox

FieldTypeDescription
labelstringField label
checkedbooleanDefault checked state
disabledbooleanDisable the field
requiredbooleanMark as required

switch — Toggle Switch

FieldTypeDescription
labelstringField label
defaultbooleanDefault state
disabledbooleanDisable the field

color — Color Picker

FieldTypeDescription
labelstringField label
defaultstringDefault color value
formatstring'hex', 'hexa', 'rgb', 'rgba', 'hsl', 'hsla'
disabledbooleanDisable the field

date / date-range — Date Picker

FieldTypeDescription
labelstringField label
defaultstring or trueDefault date, or true for today
formatstringDisplay format (e.g. 'DD/MM/YYYY')
returnStringbooleanReturn formatted string instead of timestamp
clearablebooleanShow a clear button
minstringMinimum date
maxstringMaximum date
disabledbooleanDisable the field

time — Time Picker

FieldTypeDescription
labelstringField label
defaultstringDefault time value
formatstring'12' or '24'
clearablebooleanShow a clear button
disabledbooleanDisable the field

textarea — Multi-line Text

FieldTypeDescription
labelstringField label
placeholderstringPlaceholder text
defaultstringDefault value
requiredbooleanMark as required
disabledbooleanDisable the field
autosizebooleanAuto-resize based on content
minnumberMinimum rows
maxnumberMaximum rows

Usage

Basic Input Dialog

local input = exports['flux-ui-pack']:InputDialog('Enter Details', { { type = 'input', label = 'Name', required = true }, { type = 'number', label = 'Age' }, { type = 'slider', label = 'Level', min = 0, max = 100, step = 1 } }) if input then local name = input[1] local age = input[2] local level = input[3] print(name, age, level) end

Select with Descriptions and Icons

local input = exports['flux-ui-pack']:InputDialog('Choose Role', { { type = 'select', label = 'Department', options = { { value = 'police', label = 'Police', description = 'Law enforcement', icon = 'shield' }, { value = 'medic', label = 'Medic', description = 'Emergency services', icon = 'heart-pulse' }, { value = 'fire', label = 'Fire Dept', description = 'Fire & rescue', icon = 'fire' }, }}, })

Custom Button Labels

local input = exports['flux-ui-pack']:InputDialog('Confirm Transfer', { { type = 'input', label = 'Recipient', required = true }, { type = 'number', label = 'Amount', min = 1 }, }, { allowCancel = true, labels = { cancel = 'Go Back', confirm = 'Transfer' } })

With Multiple Field Types

local input = exports['flux-ui-pack']:InputDialog('Settings', { { type = 'select', label = 'Color', options = { { value = 'red', label = 'Red' }, { value = 'blue', label = 'Blue' }, { value = 'green', label = 'Green' }, }}, { type = 'checkbox', label = 'Enable notifications', checked = true }, { type = 'color', label = 'Theme', default = '#ff0000' }, { type = 'date', label = 'Start Date', default = true }, })

Close Dialog

exports['flux-ui-pack']:CloseInputDialog()
Last updated on