Skip to content

Alert Dialog

AlertDialog modal interrupts users with important confirmation actions.

Usage

AlertDialogExample.tsx
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

PropTypeDefaultDescription
visiblebooleanModal visibility state.
titlestringDialog heading.
descriptionstringDetailed confirmation explanation.
confirmTextstring'Confirm'Primary action button text.
cancelTextstring'Cancel'Cancel action button text.
onConfirm() => voidCallback when confirm button is pressed.
onClose() => voidCallback when modal requests close.