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.
Utilização
Mark a destructive choice in an alert.
Este tipo é usado por 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');Declaração do tipo
export type AlertButton = {
text?: string;
/** At most one button is `cancel`. */
style?: AlertButtonStyle;
/** iOS: the button Return picks, shown in bold. */
preferred?: boolean;
};Membros 3
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
text | string | Não | — |
style | SpecButtonStyle | Não | At most one button is cancel. |
preferred | boolean | Não | iOS: the button Return picks, shown in bold. |
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.