Usage

Choose the input style for a prompt.

This type is used by 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 }

Type declaration

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'>;
};

Members 8

NameTypeRequiredDescription
titlestringYes—
messagestringNo—
buttonsreadonly AlertButton[]No—
cancelablebooleanNoAndroid: tapping outside or Back dismisses the alert. False by default.
colorScheme"light" | "dark"NoiOS: light or dark regardless of the app's appearance, as CSS's color-scheme.
typePromptTypeNo—
valuestringNoThe field's starting text, as TextField's value; a login's username.
inputMode"search" | "text" | "email" | "tel" | "url" | "decimal" | "numeric"NoThe 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.