33
33
34
34
## Demo
35
35
36
+ <img src =" ./img/ReactAnimatedModal.gif " >
36
37
37
38
<!-- Installation -->
38
39
@@ -51,6 +52,88 @@ npm install @dorbus/react-animated-modal
51
52
```
52
53
53
54
<!-- Usage -->
55
+ ## Usage
56
+
57
+ To use Animated Modal in your application, first import ` AnimatedModal ` , ` AnimatedModalObject ` , ` ModalAnimation ` and ` AnimatedModalFrame ` .
58
+
59
+ ### Ref
60
+
61
+ Create a Ref object using ` useRef ` and pass it to the ` AnimatedModal ` Component.
62
+
63
+ ``` typescript
64
+ const ref = useRef <AnimatedModalObject >(null );
65
+
66
+ < AnimatedModal ref = {ref } / >
67
+ ```
68
+
69
+ ### Modal Animations
70
+
71
+ For now, the library supports seven different animations:
72
+
73
+ - Unfold: ` ModalAnimation.Unfold `
74
+ - Reveal: ` ModalAnimation.Reveal `
75
+ - Uncover: ` ModalAnimation.Uncover `
76
+ - Flash: ` ModalAnimation.Flash `
77
+ - Slide: ` ModalAnimation.Slide `
78
+ - BlowUp: ` ModalAnimation.BlowUp `
79
+ - Sketch: ` ModalAnimation.Sketch `
80
+
81
+ ## Using Animations
82
+
83
+ Use animation prop to enable different animations, by default the animation is of type Unfold.
84
+
85
+ ``` typescript
86
+ < AnimatedModal
87
+ ref = {ref }
88
+ animation = {ModalAnimation.Unfold }/ >
89
+ ```
90
+
91
+ ## API
92
+
93
+ <table >
94
+ <thead>
95
+ <tr>
96
+ <th>Component</th>
97
+ <th>Prop</th>
98
+ <th>Type</th>
99
+ <th>Description</th>
100
+ <th>Default</th>
101
+ </tr>
102
+ </thead>
103
+ <tbody>
104
+ <tr>
105
+ <td rowspan=10>AnimatedModal</td>
106
+ <td>startOpen</td>
107
+ <td><code>boolean</code></td>
108
+ <td>State open state of the modal in start</td>
109
+ <td><code>false</code></td>
110
+ </tr>
111
+ <tr>
112
+ <td>animation</td>
113
+ <td><code>ModalAnimation</code></td>
114
+ <td>Different modal animations</td>
115
+ <td><code>ModalAnimation.Unfold</code></td>
116
+ </tr>
117
+ <tr>
118
+ <td>closeOnBackgroundClick</td>
119
+ <td><code>boolean</code></td>
120
+ <td>Whether the modal should close on background click</td>
121
+ <td><code>true</code></td>
122
+ </tr>
123
+ <tr>
124
+ <td>backgroundStyle</td>
125
+ <td><code>CSS</code></td>
126
+ <td>Pass custom background styles</td>
127
+ <td>-</td>
128
+ </tr>
129
+ <tr>
130
+ <td>modalStyle</td>
131
+ <td><code>CSS</code></td>
132
+ <td>Pass custom modal styles</td>
133
+ <td>-</td>
134
+ </tr>
135
+ </tbody>
136
+ </table >
54
137
55
138
## Project Created & Maintained By
56
139
0 commit comments