Skip to main content

io.group

Combines multiple I/O method calls into a single form.

Individual I/O methods await within your action until user input is provided, such that each I/O method call results in a distinct step within the generated internal app. io.group allows you to group multiple I/O methods together to request input all at once in a single step.

caution

io.confirm is not supported within an io.group.

Custom validation can be performed on groups by chaining a .validate() method call to the group. Learn more about validation here.

Usage

const [name, email, age] = await io.group([
io.input.text("Name"),
io.input.email("Email"),
io.input.number("Age"),
]);

// or

const { name, email, age } = await io.group({
name: io.input.text("Name"),
email: io.input.email("Email"),
age: io.input.number("Age"),
});

Props

Receives an array or object of I/O method calls as its first argument.

info

Dynamic arrays are supported, but discouraged as they make the result's types not statically determinable and extracting the results difficult to reason about.

continueButton

objectOptional

Customizes the button that completes the group's step within the action, submitting any info collected via I/O methods.

label

stringOptional

Text for the continue button. Defaults to "Continue".

theme

"default" | "danger"Optional

Visual theme for the continue button.

Returns

Returns an array or object (depending on input) of its constituent I/O methods' return values.

Similarly to Promise.all, if the contents are defined inline or of constant types, the return values will be correctly typed by TypeScript.

Did this section clearly explain what you wanted to learn?
On this page