Skip to main content
io.input.text() requests a string value. Provided by the @awaitio/input-text package.
A Search for field filled with refund, with help text under it

Install

Setup

Register it under the key you want in io, see Input components:
app.ts

Usage

Props

Props are checked when the io call is made: a prop of the wrong type throws in the handler.

Optional

The field is required. Chain .optional() to let it stay empty; the handler then gets string | undefined, see Optional fields.

Returns

string, exactly as typed, including surrounding spaces.

Built-in validation

The field is always required. The server checks every answer, so these messages come back even when the browser’s own checks are bypassed:
The Search for field with the message Search for is required. under it

Custom validation

Chain .validate() for a check of your own. It runs on the server after the checks above, gets the value the handler would get and returns a message to show under the field, or nothing when the value is fine; see Custom validation.