AlertOptions
What an alert says and which buttons it offers, and the base a prompt adds its text field to.
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 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';
};Membres 5
| Nom | Type | Requis | Description |
|---|---|---|---|
title | string | Oui | — |
message | string | Non | — |
buttons | readonly AlertButton[] | Non | — |
cancelable | boolean | Non | Android: tapping outside or Back dismisses the alert. False by default. |
colorScheme | "light" | "dark" | Non | iOS: light or dark regardless of the app's appearance, as CSS's color-scheme. |
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.