An open API service indexing awesome lists of open source software.

https://github.com/code9g/modal

Projet 14 de la formation "Développeur JavaScript / React" de OpenClassRooms (Partie composant)
https://github.com/code9g/modal

component npm openclassrooms react school-project

Last synced: 5 months ago
JSON representation

Projet 14 de la formation "Développeur JavaScript / React" de OpenClassRooms (Partie composant)

Awesome Lists containing this project

README

          

# code9g-modal

A react component to create and customize modals.

## Installation

To install, you can use [npm](https://npmjs.org/) or [yarn](https://yarnpkg.com):

```
npm i code9g-modal
```

or

```
yarn add code9g-modal
```

## Documentation

- isOpen: Define is the modal is open or close
- onOpen: Call function when the modal is opened
- onClose: Call function when the modal is closed
- onMouseOut: Call function when the mouse click on "modal" (not in element in children)
- onEscape: Call function when the user use escape key
- autoFocus: Define if the auto focus is used when the modal opening
- focusTrap: Define if the tabulation stay in modal
- openClass and closeClass: This class is used when modal is open or close (custom class)

## Examples

```jsx
function App() {
let subtitle;
const [isOpen, setIsOpen] = useState(false);

const open = () => setIsOpen(true);
const close = () => setIsOpen(false);

const handleOpen = () => {
console.log("The modal opened !");
};

const handleClose = () => {
console.log("The modal opened !");
};

return (



Open Modal



Hello




Submit


Close




);
}
```