Utilisation

Choose the input style for a prompt.

Ce type est utilisé par prompt

tsx
// 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

ts
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

NomTypeRequisDescription
titlestringOui—
messagestringNon—
buttonsreadonly AlertButton[]Non—
cancelablebooleanNonAndroid: tapping outside or Back dismisses the alert. False by default.
colorScheme"light" | "dark"NoniOS: light or dark regardless of the app's appearance, as CSS's color-scheme.
typePromptTypeNon—
valuestringNonThe field's starting text, as TextField's value; a login's username.
inputMode"search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric"NonThe 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.