Input control

Helpers that build a minecraft:input_control object, one for each of its types. Where a field takes one, write the helper's call; its name is the type it makes. Click a type to see what it accepts.

Boolean

Boolean
Boolean(key, label, initial?, on_true?, on_false?)
key
string (at least 1) | any

The input key, which is used to build macro command and generate custom action payload.

label
Text

Label displayed to the right of control.

initialoptional
bool

Initial value of the control. Defaults to false (unchecked).

on_trueoptional
string

String to send when the control is checked. Defaults to "true".

on_falseoptional
string

String to send when the control is unchecked. Defaults to "false".

NumberRange

NumberRange
NumberRange(key, label, start, end, width?, label_format?, step?, initial?)
key
string (at least 1) | any

The input key, which is used to build macro command and generate custom action payload.

label
Text

Label displayed on the slider.

start
number

Start value, inclusive.

end
number

End value, inclusive.

widthoptional
int 1..1024

Defaults to 200.

label_formatoptional
string

The translation to be used for building label. %1$s is replaced by label; %2$s is replaced by current value of the slider. Defaults to options.generic_value.

stepoptional
number 0..<

Step size of the input. If not present, any value from range is allowed.

initialoptional
number

Initial value of the slider. Rounded down nearest step. Defaults to the middle of the range.

SingleOption

SingleOption
SingleOption(key, label, options, width?, label_visible?)
key
string (at least 1) | any

The input key, which is used to build macro command and generate custom action payload.

label
Text

Label displayed on the button.

options
list of (Option | string) (at least 1)
widthoptional
int 1..1024

Defaults to 200.

label_visibleoptional
bool

Defaults to true.

Text

Text
Text(key, label, width?, label_visible?, initial?, max_length?, multiline?)
key
string (at least 1) | any

The input key, which is used to build macro command and generate custom action payload.

label
Text

Label displayed to the left of control.

widthoptional
int 1..1024

Defaults to 200.

label_visibleoptional
bool

Defaults to true.

initialoptional
string

Initial contents of the text input. Defaults to "" (empty string).

max_lengthoptional
int 1..

Maximum length of input Defaults to 32.

multilineoptional
{ max_lines?: int 1.., height?: int 1..512 }

If present, allows users to input multiple lines.