PromptOptions
What a prompt asks for: an alert's title, message and buttons, plus the kind of text field and its starting text.
Utilisation
Choose the input style for a prompt.
Ce type est utilisé par 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 }Déclaration du type
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'>;
};Membres 8
| Nom | Type | Requis | Description |
|---|---|---|---|
title | string | Oui | — |
message | string | Non | — |
buttons | readonly AlertButton[] | Non | — |
cancelable | boolean | Non | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | Non | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
type | PromptType | Non | — |
value | string | Non | The field's starting text, as TextField's value; a login's username. |
inputMode | "search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric" | Non | The keyboard, as TextField's inputMode; a password's too, for a PIN. |
Généré depuis les déclarations TypeScript publiques : signatures, props et valeurs par défaut viennent de la source vérifiée, les descriptions de sa JSDoc. Aucune valeur par défaut n'est inventée.