prompt
Shows an alert with a text field (docs/alert.md) and resolves with the button the user picked and what they typed, or null when they dismissed it. Cancel and OK by default.
Verwendung
Choose the input style for a 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 }Signaturen
(options: PromptOptions): Promise<{ button: AlertButton; value: PromptValue; } | null>Parameter
| Name | Typ | Erforderlich | Beschreibung |
|---|---|---|---|
options | PromptOptions | Ja | — |
Rückgabe
Promise<{ button: AlertButton; value: PromptValue;}>
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.