@augt/p14-modal
v1.0.1
Published
A simple React component pop-in modal that either shows an error message or a confirmation message.
Downloads
1
Maintainers
Readme
p14-modal
A simple React component pop-in modal that either shows an error message or a confirmation message.
Installation
It is recommanded to use Node.js v18 or newer. At the root of your React project, run the following command in your terminal to install the module:
npm install @augt/p14-modal
Usage
Use it in your app :
import { useState } from "react";
import { Modal } from "@augt/p14-modal";
function Component() {
const [showModal, setShowModal] = useState(false);
const errorMessage = "This is an error.";
return (
<>
{showModal && (
<Modal
onClose={() => setShowModal(false)}
errorMessage={errorMessage}
confirmationMessage="Success !"
/>
)}
</>
);
}
export default Component;
Props
Common props you may want to specify include:
onClose
: A function that gets executed when the user clicks on the close button.errorMessage
: The error message that shows up on the modal.confirmationMessage
: The confirmation message that shows up on the modal.
License
MIT © augt