Verwendung

Mark a destructive choice in an alert.

Dieser Typ wird verwendet von 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');

Typdeklaration

ts
export type AlertButton = {
  text?: string;
  /** At most one button is `cancel`. */
  style?: AlertButtonStyle;
  /** iOS: the button Return picks, shown in bold. */
  preferred?: boolean;
};

Mitglieder 3

NameTypErforderlichBeschreibung
textstringNein—
styleSpecButtonStyleNeinAt most one button is cancel.
preferredbooleanNeiniOS: the button Return picks, shown in bold.
Generiert aus den öffentlichen TypeScript-Deklarationen: Signaturen, Props und Standardwerte stammen aus der geprüften Quelle, Beschreibungen aus deren JSDoc. Kein Standardwert ist erfunden.