@@ -7,14 +7,14 @@ Highly customizable header, body, and footer
7
7
8
8
Try out demo here https://codesandbox.io/s/react-unimodal-hvbp1i
9
9
10
- install
10
+ #### install
11
11
```
12
12
npm i --save react-unimodal
13
13
```
14
14
15
15
add ` import 'react-unimodal/dist/style.css'; ` to your app.js file to use default styles, don't import if you want to style it yourself
16
16
17
- creating modal
17
+ #### creating modal
18
18
``` javascript
19
19
import { useUniModal } from ' react-unimodal'
20
20
// in any page/component, use useUniModal hook to create the component
@@ -29,7 +29,7 @@ function App() {
29
29
)
30
30
}
31
31
```
32
- using modal
32
+ #### using modal
33
33
``` javascript
34
34
// use these commands to control the modal
35
35
import { showModal , hideModal , updateModal } from ' react-unimodal'
@@ -53,34 +53,35 @@ const Component = () => {
53
53
}
54
54
```
55
55
56
- params to pass
56
+ #### params to pass
57
57
58
58
useUniModal
59
59
- object
60
60
- id: optional, id of modal, default is used if not set
61
61
- header: optional, header component of modal
62
62
- body: body component of modal
63
63
- footer: optional, footer component of modal
64
+ - dom node (optional, used for portal)
64
65
65
- example
66
+ #### example
66
67
67
68
` useUniModal({ id: 'modal id', header, body, footer }) ` or ` useUniModal({ header, body, footer }) `
68
69
69
70
header, body, footer can be a react element or string
70
71
71
- using portal
72
+ #### using portal
72
73
` useUniModal(config, portalDomNode) `
73
74
modal will be rendered inside portalDomNode instead of application tree
74
75
75
- showModal
76
+ #### showModal
76
77
- call this function to display modal
77
78
- id: optional, default is used if not set
78
79
79
- hideModal
80
+ #### hideModal
80
81
- call this function to hide modal
81
82
- id: optional, id of modal, default is used if not set
82
83
83
- updateModal
84
+ #### updateModal
84
85
- pass a configuration to change header, body, or footer of a modal, same as ` useUniModal `
85
86
- object
86
87
- id: optional, id of modal, default is used if not set
0 commit comments