Confirm Alert
A Confirm Alert component is a UI element that prompts users to confirm or cancel an action before proceeding. It typically displays a message asking for confirmation, along with "Confirm" and "Cancel" buttons, ensuring that the user consciously approves or rejects the action, often used for critical tasks like deletions or irreversible changes.
Rendered live, with the same build of the library you install.
ConfirmAlert.tsx
import { useState } from 'react';import { NButton, NConfirmAlert } from '@nayan-ui/react';const ConfirmAlert = () => {const [isOpen, setIsOpen] = useState(false);return (<div><NConfirmAlertisOpen={isOpen}title="Are you absolutely sure?"message="This action cannot be undone. This will permanently delete your account."onResult={result => console.log('Result:', result)}onClose={() => setIsOpen(false)}/><NButton onClick={() => setIsOpen(true)}>Show Confirm Alert</NButton></div>);};export default ConfirmAlert;
| Name | Type | Default | Details |
|---|---|---|---|
| isOpen | boolean | Required | Controls whether the confirm alert is open. |
| message | string | Required | The confirmation message to display. |
| title | string | Optional | Title for the confirmation dialog. |
| className | string | ' ' | You can customise by passing tailwind classes. |
| titleClassName | string | ' ' | You can customise by passing tailwind classes. |
| messageClassName | string | ' ' | You can customise by passing tailwind classes. |
| cancelClassName | string | ' ' | You can customise by passing tailwind classes. |
| confirmClassName | string | ' ' | You can customise by passing tailwind classes. |
| confirmText | string | Optional | Custom text for confirm button. |
| cancelText | string | Optional | Custom text for cancel button. |
| onResult | (result: boolean) => void | Required | Callback when user confirms or cancels. |
| onClose | () => void | Required | Callback when dialog is closed. |
| children | React.ReactNode | Optional | Custom content for the dialog. |
| renderActions | (onResult: (result: boolean) => void) => React.ReactNode | Optional | Custom render function for actions. |
| renderHeader | (title: string, message: string) => React.ReactNode | Optional | Custom render function for header. |
Other components solving nearby problems.
- React Confirmation Alert
- React Alert Dialog
- React Confirmation Modal
- React Warning Alert
- React Confirmation Popup
- React Alert Component
- React Modal Confirmation
- React Alert Notification
- React Confirmation Message
- React User Confirmation
- React Alert System
- React Confirmation Dialog
- Custom React Alert
- React Prompt Confirmation
- React Alert Box
- React Confirmation Box
- React Alert Handler
- React Confirmation UI
- React Confirmation Service
- React Alert User Interface
- Confirmation Dialog React
- Alert Dialog UI Component
- React Confirmation Tutorial
- Confirmation Modal Design System
- React Confirmation TypeScript
- Mobile Confirmation React
- Confirmation Best Practices
- React Confirmation Performance
- Confirmation UI Library
- User Confirmation Component