AlertOptions
What an alert says and which buttons it offers, and the base a prompt adds its text field to.
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 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';
};Membros 5
| Nome | Tipo | Obrigatório | Descrição |
|---|---|---|---|
title | string | Sim | — |
message | string | Não | — |
buttons | readonly AlertButton[] | Não | — |
cancelable | boolean | Não | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | Não | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
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.