Number input
A numeric input field
ctx.ui.inputs.number("name", config);Config
name*
stringThe name of the input. This will be the key in the result object.
label
stringThe label of the input. If this is not provided, the name will be used as the label.
helpText
stringThe help text of the input.
optional
booleanWhether the input is optional. Inputs are required by default.
disabled
booleanWhether the input is disabled.
defaultValue
numberThe default value of the input.
placeholder
stringThe placeholder text of the input.
min
numberThe minimum permitted value.
max
numberThe 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);