Dialog

A Dialog component is a UI element that displays a pop-up window over the main content to capture user attention or request input. It is often used for tasks like confirmations, alerts, forms, or other interactions that require user feedback before proceeding. Dialogs can include buttons like "OK" or "Cancel" to confirm or dismiss actions, and typically block interaction with the underlying content until closed.
# Demo
# Attributes
NameTypeDefaultDetails
classNamestring' 'You can customise by passing tailwind classes.
titleClassNamestring' 'You can customise by passing tailwind classes.
headerClassNamestring' 'You can customise by passing tailwind classes.
contentClassNamestring' 'You can customise by passing tailwind classes.
titlestringRequiredYou can pass title for dialog.
sizeDialogSizeDialogSize.MDYou can pass size of the dialog.
isOpenbooleanfalseYou can pass isOpen to show / hide alert box.
childrenstring | ReactNodeRequiredYou can pass dialog content as children.
onClose() => voidRequiredYou can get callback when dialog got closed.
# Usage
import { useState } from 'react'; import { NButton, NDialog, DialogSize } from 'nayan'; const Dialog = () => { const [isOpen, setIsOpen] = useState(false); return ( <div> <NDialog isOpen={isOpen} onClose="" {() => setIsOpen(false)} size={DialogSize.MD} title="Payment confirmation"> Your payment has been successfully submitted. We’ve sent you an email with all of the details of your order. </NDialog> <NButton onClick={() => setIsOpen(true)}>Show Dialog</NButton> </div> ); }; export default Dialog;