@fster/react-modal
v0.0.19
Published
React modal component
Downloads
24
Readme
react-modal
This package is a part of an OpenClassrooms school project.
Installation
You need to use node >= 14 and npm >= 5.6.
Run the following command on your project to install the package.
npm i @fster/react-modal@latest Dependencies
This package use [email protected] as peer dependencies.
How to use ?
Props title and text are necessary.
Use ìsVisible boolean props to render the modal.
The default target is document.body.
- Props type
export interface ModalProps {
title: string;
text: string;
isVisible: Boolean;
target: Element | DocumentFragment;
}- Example
import { Modal } from '@fster/react-modal'
function App () {
return (
<div className="App">
<Modal
title= 'Your Title'
text= 'Your content text'
isVisible= {true}
target= {document.body}
/>
</div>
);
}
export default App;