Input Dialog
Multi-field input forms supporting text, numbers, selects, checkboxes, sliders, dates, and more.
Client Exports
inputDialog
Opens an input dialog and returns the submitted values. This is an awaitable export — it yields until the user submits or cancels.
local result = exports['trinity-ui']:inputDialog(heading, rows, options)Parameters:
| Parameter | Type | Description |
|---|---|---|
heading | string | table | Dialog title, or a table with all properties |
rows | table[] | Array of field definitions |
options | table | Dialog options (optional) |
When passing a table as the first argument:
local result = exports['trinity-ui']:inputDialog({
heading = 'My Dialog',
rows = { ... },
options = { ... }
})Returns: An array of values in field order, or nil if cancelled. If options.format is set, returns a keyed table instead.
hideInputDialog
Programmatically close an open input dialog.
exports['trinity-ui']:hideInputDialog()Field Types
text
{ type = 'text', label = 'Name', placeholder = 'Enter name', default = '', required = true, min = 2, max = 50 }number
{ type = 'number', label = 'Amount', default = 1, min = 1, max = 100 }select
{ type = 'select', label = 'Color', options = {
{ label = 'Red', value = 'red' },
{ label = 'Blue', value = 'blue' },
{ label = 'Green', value = 'green' }
}, default = 'red' }checkbox
{ type = 'checkbox', label = 'Accept Terms', checked = false }switch
{ type = 'switch', label = 'Enable Notifications', checked = true }slider
{ type = 'slider', label = 'Volume', min = 0, max = 100, default = 50 }textarea
{ type = 'textarea', label = 'Description', placeholder = 'Enter details...', min = 10, max = 500 }color
{ type = 'color', label = 'Pick a Color', default = '#ff0000' }date
{ type = 'date', label = 'Start Date' }time
{ type = 'time', label = 'Appointment Time' }date-range
{ type = 'date-range', label = 'Vacation Period' }Example
local result = exports['trinity-ui']:inputDialog('Create Character', {
{ type = 'text', label = 'First Name', placeholder = 'John', required = true },
{ type = 'text', label = 'Last Name', placeholder = 'Doe', required = true },
{ type = 'number', label = 'Age', min = 18, max = 80, default = 25 },
{ type = 'select', label = 'Gender', options = {
{ label = 'Male', value = 'male' },
{ label = 'Female', value = 'female' }
}},
{ type = 'slider', label = 'Height (cm)', min = 150, max = 200, default = 175 },
{ type = 'textarea', label = 'Backstory', placeholder = 'Tell us about your character...' }
})
if result then
local firstName = result[1]
local lastName = result[2]
local age = result[3]
local gender = result[4]
local height = result[5]
local backstory = result[6]
print(('Creating %s %s, age %d'):format(firstName, lastName, age))
endSet options.format = true to receive results as a keyed table (using field labels as keys) instead of an indexed array.
Last updated on