Skip to main content
Version: 1.0.3

Dialog Box

The Dialog Box component provides a flexible way to display modal dialogs with various animations and types. It's built on top of Framer Motion for smooth animations and supports different dialog types like alerts, confirmations, and custom content.

Installation

ignix add component dialogbox

Basic Usage

1. Wrap your app with DialogProvider

import { DialogProvider } from '@ignix-ui/dialogbox';

function App() {
return (
<DialogProvider>
{/* Your app components */}
</DialogProvider>
);
}

2. Use the useDialog hook in your components

import { useDialog } from '@ignix-ui/dialogbox';

function MyComponent() {
const { openDialog } = useDialog();

const handleClick = () => {
openDialog({
title: 'Hello',
content: 'This is a dialog!',
dialogType: 'alert'
});
};

return <button onClick={handleClick}>Open Dialog</button>;
}

Props

DialogProps

PropTypeDefaultDescription
titlestring-Title of the dialog box
contentstring-Text content to display (if children is not provided)
childrenReact.ReactNode-Custom content to display inside the dialog
dialogType'success' | 'confirm' | 'error' | 'alert' | 'info' | 'warning''alert'Visual style variant of the dialog
animationKeyDialogAnimationTypes'popIn'Type of entrance/exit animation
size'sm' | 'md' | 'lg' | 'xl''md'Maximum width of the dialog
showCloseButtonbooleantrueWhether to show the close button in the header
confirmButtonTextstring'Confirm'Label for the primary action button
cancelButtonTextstring'Cancel'Label for the secondary action button
defaultButtonsbooleanfalseIf true, hides the default action buttons
confirmationCallBack(confirm: boolean) => void-Callback fired when a confirm dialog is resolved
headerStylesCSSProperties-Custom styles for the dialog header