Aller au contenu principal

ConfirmationDialog Component

Description

The ConfirmationDialog component provides a standard confirmation popup with customizable actions.

Props

PropTypeDefaultDescription
openbooleanfalseControls whether the dialog is visible.
titlestring""The title of the confirmation dialog.
contentstring""The content message of the dialog.
onClose() => voidundefinedCallback function when the dialog is closed.
onAccept() => voidundefinedCallback function when the "Yes" button is clicked.
onDecline() => voidundefinedCallback function when the "No" button is clicked.

Example Usage

import { ConfirmationDialog, Button } from "@nomana-it/liberty-core"
import { useState } from "react";

export const ConfirmationDialogExample = () => {
const [open, setOpen] = useState(false);

return (
<div>
<Button onClick={() => setOpen(true)}>Open Confirmation Dialog</Button>
<ConfirmationDialog
open={open}
title="Confirm Action"
content="Are you sure you want to proceed?"
onClose={() => setOpen(false)}
onAccept={() => {
alert("Accepted");
setOpen(false);
}}
onDecline={() => {
alert("Declined");
setOpen(false);
}}
/>
</div>
);
};

🔗 GitHub Repository (Core): Liberty Core
🔗 GitHub Repository (Test Project): Liberty Test
📖 Live Documentation: Liberty Core Docs
💖 Sponsor & Support: Sponsor Liberty Core