An easy-friendly Modal component for React.
- A text editor`
- Node.js < v.16
- Git
message
: {string} the message in the modalmodalColor
: {string} the color value of the modalbgColor
: {string} the color value of the backgroundbtnColor
: {string} the color value of the close buttonsize
: {"sm", "md", "lg", "fit"} correspond to the modal width, padding and button sizecorner
: {string} correspond to the border-radius of the modaljustify
: {string} justify-content of the text inside the modalopen
: {boolean} show the modal if set as trueclose
: {function} a function that should be used with useState to changeopen
as true or false
const App = () => {
const [isOpen, setIsOpen] = useState(false);
function handleOpenModal() {
setIsOpen(true);
}
return (
<>
<button type="button" onClick={handleOpenModal}>
Close
</button>
<Modal
message="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur mattis lacus quis metus tempus aliquam. Cras a nulla aliquet, sodales leo vel, molestie ex. Suspendisse ornare sapien nec efficitur tincidunt. Sed dignissim felis in tortor hendrerit viverra."
open={isOpen}
close={() => setIsOpen(!isOpen)}
/>
</>
);
};
export default App;