Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit 9faf970

Browse files
committed
Update README.md
1 parent 21bea97 commit 9faf970

File tree

1 file changed

+66
-2
lines changed

1 file changed

+66
-2
lines changed

README.md

+66-2
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,81 @@
11
# react-css-transition
22

3-
Take back control of CSS Transitions for React!
4-
53
[![NPM Version Widget]][npm version]
64
[![Build Status Widget]][build status]
75
[![Coverage Widget]][coverage]
86

7+
_React CSS Transition_ provides a reliable way to transition your components between two states across browers.
8+
9+
[Read the full documentation](https://wikiwi.github.io/react-css-transition/)
10+
911
## Installation
1012

1113
```sh
1214
npm install react-css-transition --save
1315
```
1416

17+
## Features
18+
19+
- Transition between the _default state_ and the _active state_
20+
- Perform a reverse transition when interrupted
21+
- Define transitions using inline styles or CSS classes
22+
- Transition components when entering or leaving the DOM
23+
- Notifiy when a transition has finished
24+
- Support the application of initial values before a transition
25+
- Includes typescript definitions
26+
27+
## Examples
28+
29+
A component that fades in when props changes to `active=true` and fades out when `active=false`:
30+
31+
```js
32+
import * as React from "react";
33+
import { CSSTransition, transit } from "react-css-transition";
34+
35+
const FadeInOutComponent = ({active, ...rest}) => (
36+
<CSSTransition
37+
defaultStyle={{ opacity: 0 }}
38+
enterStyle={{ opacity: transit(1.0, 500, "ease-in-out") }}
39+
leaveStyle={{ opacity: transit(0, 500, "ease-in-out") }}
40+
activeStyle={{ opacity: 1.0 }}
41+
active={props.active}
42+
>
43+
<MyComponent {...rest} />
44+
</CSSTransition>
45+
);
46+
```
47+
48+
A transition group that fades in and out its children:
49+
50+
```js
51+
import { CSSTransitionGroup, CSSTransition, transit } from "react-css-transition";
52+
53+
const FadeInOut = (props) => (
54+
<CSSTransition
55+
{...props}
56+
defaultStyle={{ opacity: 0 }}
57+
enterStyle={{ opacity: transit(1.0, 500, "ease-in-out") }}
58+
leaveStyle={{ opacity: transit(0, 500, "ease-in-out") }}
59+
activeStyle={{ opacity: 1.0 }}
60+
/>
61+
);
62+
63+
const FadeInOutGroup = (props) => (
64+
<CSSTransitionGroup {...props}>
65+
{
66+
React.Children.map(
67+
props.children,
68+
(child) => <FadeInOut>{child}</FadeInOut>,
69+
)
70+
}
71+
</CSSTransitionGroup>
72+
);
73+
```
74+
75+
## License
76+
77+
MIT
78+
1579

1680
[npm version]: https://www.npmjs.com/package/react-css-transition
1781

0 commit comments

Comments
 (0)