Licence
MIT
Version
1.0.6
Deps
0
Size
653 kB
Vulns
0
Weekly
0
React component for easily transitioning your container size based on children
Implemented using React Hooks and make use of
HTMLObjectElement for listening to your component resize events
See working example here.
Installation
$ yarn add react-transitioning-container # or using npm
Usage
import React from 'react';
import TransitioningContainer from 'react-transitioning-container';
import LargeContent from './LargeContent';
import SmallContent from './SmallContent';
export default function App({ isLarge }) {
return (
<TransitioningContainer duration={500}>
{isLarge ? <LargeContent /> : <SmallContent />}
</TransitioningContainer>
);
}
API
<TransitioningContainer> component accepts these following props:
| Name | Description | Type |
|---|---|---|
duration |
Transition duration in ms. | number |
timingFunction? |
Transition timing function. Default: 'ease' |
string |
children |
Its size changes will trigger the container transition. | Node or string |
...others |
Other valid attributes to be added to the root div. |
any |
License
react-transitioning-container is available under the MIT License.

