Popup Modal Component Usage
ℹ️
The PopupModal component is used to render a modal that can be opened and closed. The PopupModal component requires this props:
ℹ️
Here is an example of how to use the PopupModal component:
import React, { useState } from "react";
import { PopupModal, Button } from "@/@core";
const PopupModalExample = () => {
const [show, setShow] = useState(false);
return (
<div>
<Button onClick={() => setShow(!show)}>Open Modal</Button>
<PopupModal
show={show}
onClose={() => setShow(false)}
title="Modal Title"
titleSize="lg"
titleClassName="text-red-500"
closeIconClassName="text-red-500"
bodyClassName="bg-red-500"
overlayClassName="bg-red-500"
>
<div className="p-4">
<p className="text-white">Modal Content</p>
</div>
</PopupModal>
</div>
);
};ℹ️
The PopupModal component also has these optional props:
| 0 | Name | Type | Default | Description |
|---|---|---|---|---|
| 1 | show | boolean | false | Boolean value that determines whether the modal is open or closed required |
| 2 | onClose | function | () => {} | Function that is called when the modal is closed required |
| 3 | children | node | null | The content of the modal required |
| 4 | title | string | null | The title of the modal |
| 5 | className | string | null | The class name of the modal |
| 6 | titleSize | string | md | The size of the title, can be sm, md, lg, or xl |
| 7 | titleClassName | string | null | The class name of the title |
| 8 | closeIconClassName | string | null | The class name of the close icon |
| 9 | bodyClassName | string | null | The class name of the body |
| 10 | overlayClassName | string | null | The class name of the overlay |
ℹ️
Node: The PopupModal also support the other props that are supported by an
HTML div element.