Skip to content
S3ctor’s S3cret St4sh
api

numberInput

Edit a number with commit-time clamping and stepping.

Builds a TextEdit that preserves raw text while editing and normalizes it on focus loss. Invalid text reverts to the last value; integer = true rounds to integral values.

Example

local amount = 20

ui.numberInput {
  value = amount,
  min = 5,
  max = 100,
  step = 5,
  integer = true,
  onChange = function(value)
    amount = value
    print('Changed:', value)
  end,
  onCommit = function(value)
    print('Committed:', value)
  end,
}

Parameters

FieldTypeDescription
valuenumberInitial numeric value.
minnumber?Lower bound.
maxnumber?Upper bound.
stepnumber?Commit-time increment.
integerboolean?Round committed values to integers.
onChangefunction?Runs when the committed number changes.
onCommitfunction?Runs after every focus-loss commit.
templateopenmw.ui.Template?Replaces the default text-edit template.

Common layout fields are documented on the UI Components overview. Integer min, max, and step must themselves be integral.

See also

textInput · slider · searchInput