Text input
A text input field
ctx.ui.inputs.text("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
stringThe default value of the input.
placeholder
stringThe placeholder text of the input.
multiline
booleanWhether the input is a multiline text input. Default is false and will render a single line text input.
maxLength
numberThe maximum length of the input.
minLength
numberThe minimum length of the input.
Usage
Elements are rendered by by adding to a page. A page that contains input elements, will return an object with the keys matching the name property of each input.
const result = await ctx.ui.page({
title: "Text inputs",
content: [
ctx.ui.inputs.text("name");
ctx.ui.inputs.text("email", {
label: "Email address",
placeholder: "Enter your email address",
}),
],
});
console.log(result.name);
console.log(result.email);