You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`react-simple-hook-modal` has a super simple API and utilises React hooks.
25
26
27
+
- Simply wrap your app in `<ModalProvider/>`
28
+
- Add instances of `<Modal/>` wherever you want to display a modal
29
+
- This will not render anything to the DOM here
30
+
- Modals are rendered after allthe children in side `<ModalProvider/>`
31
+
- Use the `useModal` hook to control your modal's state
32
+
26
33
```
27
34
import { ModalProvider, Modal, useModal } from 'react-simple-hook-modal';
28
35
@@ -53,12 +60,14 @@ const App = () => (
53
60
```
54
61
55
62
## Styles
63
+
56
64
`react-simple-hook-modal` uses a subset of [tailwindcss][tailwind] under the hood. The tailwind classes used have a prefix of `rsm` added to avoid potential conflicts with your own styles. You can import the default styles using:
65
+
57
66
```
58
-
import 'react-simple-hook-modal/styles.css';
67
+
import 'react-simple-hook-modal/dist/styles.css';
59
68
```
60
-
`ModalProvider` also takes an optional `backdropClassName` which can contain one or more classes to append and override the default styles (e.g. Changing the backdrop colour can be done by adding the class `bg-blue-800`).
61
69
70
+
`ModalProvider` also takes an optional `backdropClassName` which can contain one or more classes to append and override the default styles (e.g. Changing the backdrop colour can be done by adding the class `bg-blue-800`).
62
71
63
72
# Example
64
73
@@ -76,12 +85,8 @@ If you have any issues, please create an issue here on GitHub.
0 commit comments