AlertButton
One button of an alert or a prompt, as the app lists it and as the call resolves with the one the user picked.
Utilisation
Mark a destructive choice in an alert.
Ce type est utilisé par alert
// 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
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
| Nom | Type | Requis | Description |
|---|---|---|---|
text | string | Non | — |
style | SpecButtonStyle | Non | At most one button is cancel. |
preferred | boolean | Non | iOS: 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.