Alert Dialog
AlertDialog modal interrupts users with important confirmation actions.
Usage
import { useState } from 'react';import { AlertDialog, Button } from '@masumdev/rn-ui';
export function AlertDialogExample() { const [open, setOpen] = useState(false);
return ( <> <Button tone="danger" onPress={() => setOpen(true)}>Delete Account</Button> <AlertDialog visible={open} tone="danger" title="Delete Account?" description="This action cannot be undone. All your data will be permanently removed." confirmText="Yes, Delete" cancelText="Cancel" onClose={() => setOpen(false)} onConfirm={() => setOpen(false)} /> </> );}Props API
| Prop | Type | Default | Description |
|---|---|---|---|
visible | boolean | — | Modal visibility state. |
title | string | — | Dialog heading. |
description | string | — | Detailed confirmation explanation. |
confirmText | string | 'Confirm' | Primary action button text. |
cancelText | string | 'Cancel' | Cancel action button text. |
onConfirm | () => void | — | Callback when confirm button is pressed. |
onClose | () => void | — | Callback when modal requests close. |