Number input
A numeric input field
ctx.ui.inputs.number("name", config);
Config
name*
string
The name of the input. This will be the key in the result object.
label
string
The label of the input. If this is not provided, the name will be used as the label.
helpText
string
The help text of the input.
optional
boolean
Whether the input is optional. Inputs are required by default.
disabled
boolean
Whether the input is disabled.
defaultValue
number
The default value of the input.
placeholder
string
The placeholder text of the input.
min
number
The minimum permitted value.
max
number
The maximum permitted value.
Usage
Elements are rendered by adding them to a page
. A page that contains input elements will return an object with keys matching the name
of each input.
const result = await ctx.ui.page({
title: "Number inputs",
content: [
ctx.ui.inputs.number("height"),
ctx.ui.inputs.number("age", {
label: "Your age",
placeholder: "Enter your age",
min: 0,
max: 120,
}),
],
});
console.log(result.height);
console.log(result.age);