3.0.1 • Published 7 months ago
elementswift.dialog v3.0.1
elementswift.dialog
An easy-to-use, customizable dialog (modal) component for React.
Installation
npm install elementswift.dialog
Usage
import Dialog from 'elementswift.dialog';
function MyApp() {
const [isOpen, setIsOpen] = React.useState(false);
return (
<div>
<button onClick={() => setIsOpen(true)}>Open Dialog</button>
<Dialog
isOpen={isOpen}
dialogTitle="My Dialog Title"
onClose={() => setIsOpen(false)}
>
<p>Your content goes here...</p>
</Dialog>
</div>
);
}
Props
dialogTitle
(string): The title to display at the top of the dialog.children
(node): The content to be displayed inside the dialog.onClose
(function, required): A handler function to be called when the close button is clicked.isOpen
(boolean, required): A boolean to control the visibility of the dialog.
License
MIT