Utilização

Mark a destructive choice in an alert.

Este tipo é usado por alert

tsx
// Mark a destructive choice in an alert.
import { alert, type AlertButtonStyle } from 'kuito';

const choice = (text: string, style: AlertButtonStyle) => ({ text, style });

const picked = await alert({
  title: 'Delete this draft?',
  buttons: [choice('Cancel', 'cancel'), choice('Delete', 'destructive')],
});

if (picked?.style === 'destructive') console.log('deleted');

Declaração do tipo

ts
export type AlertOptions = {
  title: string;
  message?: string;
  buttons?: readonly AlertButton[];
  /** Android: tapping outside or Back dismisses the alert. False by default. */
  cancelable?: boolean;
  /** iOS: light or dark regardless of the app's appearance, as CSS's `color-scheme`. */
  colorScheme?: 'light' | 'dark';
};

Membros 5

NomeTipoObrigatórioDescrição
titlestringSim—
messagestringNão—
buttonsreadonly AlertButton[]Não—
cancelablebooleanNãoAndroid: tapping outside or Back dismisses the alert. False by default.
colorScheme"light" | "dark"NãoiOS: light or dark regardless of the app's appearance, as CSS's color-scheme.
Gerado a partir das declarações TypeScript públicas: assinaturas, props e predefinições vêm da fonte verificada, as descrições da sua JSDoc. Nenhuma predefinição é inventada.