io.input.boolean

Yes or no, with a checkbox.

io.input.boolean asks a yes or no question with a checkbox. The handler gets true when the box is checked and false when it is not. Good for a choice that goes along with the action, such as emailing the customer.

The simplest one

The whole action file, and roughly what your team sees when it runs.

src/actions/orders/cancelOrderAction.ts
import { app } from '../../app';
export const cancelOrderAction = app.defineAction({
name: 'Cancel order',
handler: async ({ io }) => {
const notify = await io.input.boolean('Email the customer', {
defaultValue: true,
helpText: 'They get a copy of the cancellation',
});
},
});
The code. One call in an action, the whole file.
tools.example.com/actions/orders/cancel_order

Cancel order

Email the customer
✓They get a copy of the cancellation
Continue
In the browser. Roughly what your team sees. Your theme decides the details.

What you can set

The settings you will reach for most, each with the line of code that turns it on.

helpText: 'They get a copy'

What checking means. The help text sits to the right of the box and says what a tick does. Every checkbox has one.

defaultValue: true

Checked from the start. The box starts empty. With defaultValue: true it starts checked.

if (sendEmail) await sendCopy(order);

True or false. The handler gets a boolean. An empty box is a valid answer, so nothing is checked on the way.

.validate((isChecked) => check(isChecked))

A box that must be ticked. .validate() can refuse an empty box with your message. The person answers again until it passes.

defaultValue: true, disabled: true

Shown, not changed. With disabled the box shows its value and cannot be changed. The handler gets that value whatever the browser sends.

await io.group({ amount, sendEmail })

Next to other fields. Inside io.group the checkbox shares one form with other fields. The handler gets all the values together.

Write your first tool today.

An async function, a few await calls, and the form is in the browser.

AwaitIO is free for small teams, made possible by companies and people who sponsor it.