Skip to main content

Create text box

Displays a TextBox that executes the user’s input.
Lean.API.TextBox(placeholder, title, onlyNumbers, maxChars, callback)

Parameters

  • placeholder (string) - Placeholder text shown in the input field
  • title (string) - Title displayed on the text box
  • onlyNumbers (boolean) - If true, only accepts numeric input
  • maxChars (number) - Maximum number of characters allowed. Don’t include for no limit
  • callback (function) - Function called with the input value when submitted

Returns

Nothing

Example

Lean.API.TextBox("Enter text", "Input Box", false, 100, function(input)
    print(input)
end)

Example with trigger

-- Boolean accepts numbers only, up to 10 digits
Lean.API.TextBox("Enter Amount", "Add Money", true, 10, function(amount)
    local amt = tonumber(amount)
    Lean.API.TriggerServerEvent({ resource = "lean_jobs" }, 'lean:collect:pay_check', amt)
end)