PromptOptions
What a prompt asks for: an alert's title, message and buttons, plus the kind of text field and its starting text.
Usage
Choose the input style for a prompt.
This type is used by prompt
// Choose the input style for a prompt.
import { prompt, type PromptType } from 'kuito';
async function ask(title: string, type: PromptType) {
const answer = await prompt({ title, type });
return answer?.value ?? null;
}
const pin = await ask('Enter your PIN', 'password');
const login = await ask('Sign in to Wi-Fi', 'login'); // { username, password }Type declaration
export type PromptOptions = AlertOptions & {
type?: PromptType;
/** The field's starting text, as TextField's `value`; a login's username. */
value?: string;
/** The keyboard, as TextField's `inputMode`; a password's too, for a PIN. */
inputMode?: Exclude<InputMode, 'none'>;
};Members 8
| Name | Type | Required | Description |
|---|---|---|---|
title | string | Yes | — |
message | string | No | — |
buttons | readonly AlertButton[] | No | — |
cancelable | boolean | No | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | No | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
type | PromptType | No | — |
value | string | No | The field's starting text, as TextField's value; a login's username. |
inputMode | "search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric" | No | The keyboard, as TextField's inputMode; a password's too, for a PIN. |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.