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 AlertButton = {
  text?: string;
  /** At most one button is `cancel`. */
  style?: AlertButtonStyle;
  /** iOS: the button Return picks, shown in bold. */
  preferred?: boolean;
};

Membres 3

NomTypeRequisDescription
textstringNon—
styleSpecButtonStyleNonAt most one button is cancel.
preferredbooleanNoniOS: the button Return picks, shown in bold.
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.