PromptOptions
What a prompt asks for: an alert's title, message and buttons, plus the kind of text field and its starting text.
Verwendung
Choose the input style for a prompt.
Dieser Typ wird verwendet von 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 }Typdeklaration
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'>;
};Mitglieder 8
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
title | string | Ja | — |
message | string | Nein | — |
buttons | readonly AlertButton[] | Nein | — |
cancelable | boolean | Nein | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | Nein | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
type | PromptType | Nein | — |
value | string | Nein | The field's starting text, as TextField's value; a login's username. |
inputMode | "search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric" | Nein | The keyboard, as TextField's inputMode; a password's too, for a PIN. |
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.