Utilisation

Mark a destructive choice in an alert.

Ce type est utilisé par 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');

Déclaration du type

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

Membres 5

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.
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.