Question Types

Short Text

The short question type lets you collect a single line of text from the user. You can also use it to collect email addresses, URLs, and phone numbers.

Here's a simple example:

await form.short('What is your name?');

Which generates a question that looks like this:

Return Value

short() returns a string containing the user's answer, which you can use in the rest of the script:

let name = await form.short('What is your name?');

if (name.toLowerCase().includes("homer")) {
  await form.statement("D'oh!");
} else {
  await form.statement("Thanks!");

Using the answer from one question within the text of a subsequent question is a special case that requires a tiny bit of extra care. More details on the Interpolation page.


You can pass options to short like so:

await form.short('What is your email address', {email: true});

Here's a list of all short-specific options:

Option Type
email boolean Only email addresses will be accepted if true
url boolean Only URLs will be accepted if true
tel boolean Only phone numbers will be accepted if true
number boolean Only numeric input will be accepted if true
value string Prefill the answer with this value

You can also pass global options, which are valid for all question types.