a boolean value to initialize the modal to a closed, non-apparent state
onClick
fonction à inclure pour ouvrir ou fermer le modal avec le boutton de la modal
message
a message string to display in the modal
color
a css color type string customizing the text color of the modal example: "#ffffff" if not filled in by default the color is: #000000
animationType
a string containing the modal's opening animation option, see options below
borderColor
a string containing the edge color option of the modal, see options below
Modal options
Props name
Options
Description
color
default
the modal will not have a border
success
the modal will have green borders
alert
the modal will have red borders
blue
the modal will have blue borders
Props name
Options
Description
animationType
up
the modal will appear when descending
dowm
the modal will appear ascending
left
the modal will appear coming from the left of the screen
right
the modal will appear coming from the right of the screen
Usage
importReact,{useState}from'react'import{ModalCustom}from'modal-custom-jb'constApp=()=>{// function to display the modal in the exampleconstclickButton=()=>{setIsOpen(true)}// state for example action display messageconst[displayMessage,setDisplayMessage]=useState(false)// modal display state neededconst[isOpen,setIsOpen]=useState(false)constmodalIsClose=()=>{setIsOpen(false)// example of action performed after closing the modalsetDisplayMessage(true)setTimeout(()=>{setDisplayMessage(false)},"1000")}return(<><buttonclassName='btnForExample'onClick={clickButton}>click to open modal</button>{displayMessage&&<pclassName='messageExample'>Hello World !</p>}<ModalCustomopenModal={isOpen}closeModal={modalIsClose}message="Création du nouvel employé réussi !"messageColor="#000000"animation="right"border="blue"/></>)}exportdefaultApp