Skip to content

Commit 1a82c8f

Browse files
committed
(docs): Readme Updated
1 parent 4e1f7f7 commit 1a82c8f

File tree

2 files changed

+83
-0
lines changed

2 files changed

+83
-0
lines changed

README.md

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
## Demo
3535

36+
<img src="./img/ReactAnimatedModal.gif">
3637

3738
<!-- Installation -->
3839

@@ -51,6 +52,88 @@ npm install @dorbus/react-animated-modal
5152
```
5253

5354
<!-- 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>
54137

55138
## Project Created & Maintained By
56139

img/ReactAnimatedModal.gif

1.11 MB
Loading

0 commit comments

Comments
 (0)