Files
ashlar/docs/source/reference/lua-scripting/setting_renderers.rst
T
MathiasandClaude Fable 5 4f93c2460e Clamp out-of-range values in the number settings renderer (#9183)
Previously the number renderer silently discarded input outside the
min/max range and restored the stored value, forcing users to guess the
limits. Clamp to the nearest bound instead.

The integer check runs before clamping so that non-integer input is
still rejected for integer settings rather than accepted whenever it
happens to clamp to an integral bound.

The focusLoss handler now always stores the resolved value - the clamped
number, or the previous value when the input cannot be parsed. Writing
the setting is what rebuilds the widget, so a value that clamps onto the
value already stored would otherwise leave the raw text on display.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-29 08:56:49 +02:00

152 lines
2.6 KiB
ReStructuredText

Setting Renderers
=================
.. include:: version.rst
textLine
--------
Single line text input
**Argument**
Table with the following optional fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - disabled
- bool (false)
- Disables changing the setting from the UI
checkbox
--------
True / false (yes/no) toggle
**Argument**
Table with the following optional fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - disabled
- bool (false)
- Disables changing the setting from the UI
* - l10n
- string ('Interface')
- Localization context with display values for the true/false values
* - trueLabel
- string ('Yes')
- Localization key to display for the true value
* - falseLabel
- string ('No')
- Localization key to display for the false value
number
------
Numeric input
**Argument**
Table with the following optional fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - disabled
- bool (false)
- Disables changing the setting from the UI
* - integer
- bool (false)
- Only allow integer values
* - min
- number (nil)
- If set, entered values smaller than min are clamped to min
* - max
- number (nil)
- If set, entered values larger than max are clamped to max
select
------
A small selection box with two next / previous arrows on the sides
**Argument**
Table with the following optional fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - disabled
- bool (false)
- Disables changing the setting from the UI
* - l10n
- string (required)
- Localization context with display values for items
* - items
- #list<string> ({})
- List of options to choose from, all the viable values of the setting
color
-----
Hex-code color input with a preview
**Argument**
Table with the following optional fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - disabled
- bool (false)
- Disables changing the setting from the UI
inputBinding
------------
Allows the user to bind inputs to an action or trigger
**Argument**
Table with the following fields:
.. list-table::
:header-rows: 1
:widths: 20 20 60
* - name
- type (default)
- description
* - key
- #string
- Key of the action or trigger to which the input is bound
* - type
- 'action', 'trigger'
- Type of the key