Skip to content

prompt

prompt(message, defaultValue?, opts?): Promise<string>

Defined in: components/dialog.ts:309

Shows a prompt dialog with a text input. Returns a Promise<string | null> — the entered string if the user confirmed, or null if cancelled.

string

string = ""

Partial<DialogOptions> = {}

Promise<string>

const name = await S.prompt("Enter your name:", "Alice");
if (name !== null) S.alert(`Hi ${name}!`);