Input Dialog
Display a dialog with multiple input fields for collecting player data.
Exports
| Export | Parameters | Returns |
|---|---|---|
InputDialog | (heading, rows, options) | table or nil — Array of input values, or nil if cancelled |
CloseInputDialog | () | — |
InputDialog Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
heading | string | Yes | Dialog title |
rows | table | Yes | Array of row definitions |
options | table | No | Additional options |
Options
| Field | Type | Description |
|---|---|---|
allowCancel | boolean | Whether the dialog can be cancelled (default: true) |
size | string | Modal size: 'xs', 'sm', 'md', 'lg', 'xl' |
labels.cancel | string | Custom cancel button text |
labels.confirm | string | Custom confirm button text |
Row Types
input — Text Input
| Field | Type | Description |
|---|---|---|
label | string | Field label |
description | string | Help text below the label |
icon | string | Icon inside the input |
placeholder | string | Placeholder text |
default | string | Default value |
required | boolean | Mark as required |
disabled | boolean | Disable the field |
password | boolean | Hide input as password |
min | number | Minimum character length |
max | number | Maximum character length |
number — Number Input
| Field | Type | Description |
|---|---|---|
label | string | Field label |
description | string | Help text below the label |
icon | string | Icon inside the input |
default | number | Default value |
min | number | Minimum value |
max | number | Maximum value |
step | number | Step increment |
precision | number | Decimal places |
required | boolean | Mark as required |
disabled | boolean | Disable the field |
select / multi-select — Dropdown
| Field | Type | Description |
|---|---|---|
label | string | Field label |
description | string | Help text below the label |
icon | string | Icon inside the input |
options | table | Array of options (see below) |
default | string or table | Default selected value(s) |
required | boolean | Mark as required |
disabled | boolean | Disable the field |
clearable | boolean | Show a clear button |
searchable | boolean | Enable search in dropdown |
maxSelectedValues | number | Limit selections (multi-select) |
Option Fields
| Field | Type | Description |
|---|---|---|
value | string | Option value returned on submit |
label | string | Display text |
description | string | Description shown below the label in the dropdown |
icon | string | FontAwesome icon shown next to the option |
slider — Range Slider
| Field | Type | Description |
|---|---|---|
label | string | Field label |
description | string | Help text below the label |
default | number | Default value |
min | number | Minimum value |
max | number | Maximum value |
step | number | Step increment |
required | boolean | Mark as required |
disabled | boolean | Disable the field |
checkbox — Checkbox
| Field | Type | Description |
|---|---|---|
label | string | Field label |
checked | boolean | Default checked state |
disabled | boolean | Disable the field |
required | boolean | Mark as required |
switch — Toggle Switch
| Field | Type | Description |
|---|---|---|
label | string | Field label |
default | boolean | Default state |
disabled | boolean | Disable the field |
color — Color Picker
| Field | Type | Description |
|---|---|---|
label | string | Field label |
default | string | Default color value |
format | string | 'hex', 'hexa', 'rgb', 'rgba', 'hsl', 'hsla' |
disabled | boolean | Disable the field |
date / date-range — Date Picker
| Field | Type | Description |
|---|---|---|
label | string | Field label |
default | string or true | Default date, or true for today |
format | string | Display format (e.g. 'DD/MM/YYYY') |
returnString | boolean | Return formatted string instead of timestamp |
clearable | boolean | Show a clear button |
min | string | Minimum date |
max | string | Maximum date |
disabled | boolean | Disable the field |
time — Time Picker
| Field | Type | Description |
|---|---|---|
label | string | Field label |
default | string | Default time value |
format | string | '12' or '24' |
clearable | boolean | Show a clear button |
disabled | boolean | Disable the field |
textarea — Multi-line Text
| Field | Type | Description |
|---|---|---|
label | string | Field label |
placeholder | string | Placeholder text |
default | string | Default value |
required | boolean | Mark as required |
disabled | boolean | Disable the field |
autosize | boolean | Auto-resize based on content |
min | number | Minimum rows |
max | number | Maximum 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)
endSelect 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