Input

Functions
input(name, options)
Creates and displays an input form with various field types.
Parameters:
name
(string, optional): Title of the input form. Defaults to 'Input Menu' if not providedoptions
(table): Array of input field configurations, each containing:type
(string): Input field type ('text', 'number', 'select', 'checkbox', 'textarea')title
(string): Label text for the input fieldplaceholder
(string/number, optional): Placeholder text or default valuerequired
(boolean, optional): Whether the field is requireddescription
(string, optional): Additional description textmin
(number, optional): Minimum value for number inputsmax
(number, optional): Maximum value for number inputsoptions
(table, optional): Options array for select inputs withlabel
andvalue
properties
Returns:
result
(table): Form data with field values, ornil
if cancelled
Exports:
Standard Export:
exports['ps-lib']:input(name, options)
PS-UI Export (Legacy Support):
exports['ps-ui']:input(name, options)
Input Field Types
Text Input
{
type = 'text',
title = 'Enter your name',
placeholder = 'Full Name',
required = true
}
Number Input
{
type = 'number',
title = 'Enter amount',
placeholder = 100,
required = true,
min = 1,
max = 999999
}
Select Dropdown
{
type = 'select',
title = 'Choose option',
options = {
{ label = 'Option 1', value = 'opt1' },
{ label = 'Option 2', value = 'opt2' }
},
required = false
}
Checkbox
{
type = 'checkbox',
title = 'Accept terms',
description = 'I agree to the terms and conditions',
required = true
}
Textarea
{
type = 'textarea',
title = 'Comments',
placeholder = 'Enter your comments here...',
required = false
}
Usage Examples
Basic User Registration Form
local function showRegistrationForm()
local options = {
{
type = 'text',
title = 'First Name',
placeholder = 'Enter first name',
required = true
},
{
type = 'text',
title = 'Last Name',
placeholder = 'Enter last name',
required = true
},
{
type = 'number',
title = 'Age',
placeholder = 18,
required = true,
min = 16,
max = 100
},
{
type = 'select',
title = 'Gender',
options = {
{ label = 'Male', value = 'male' },
{ label = 'Female', value = 'female' },
{ label = 'Other', value = 'other' }
},
required = true
}
}
local result = exports['ps-lib']:input('Character Registration', options)
if result then
TriggerServerEvent('character:create', result)
ps.notify('Character created successfully!', 'success')
else
ps.notify('Registration cancelled', 'error')
end
end
Last updated