Skip to content

AlbertLucianto/react-transition-box

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

40 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React Transition Box

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

Build Status Downloads Downloads Version License License

React Transition Box

See working example here.

Installation

$ yarn add react-transition-box # or using npm

Usage

import React from 'react';
import TransitionBox from 'react-transition-box';
import LargeContent from './LargeContent';
import SmallContent from './SmallContent';

export default function App({ isLarge }) {
  return (
    <TransitionBox duration={500}>
      {isLarge ? <LargeContent /> : <SmallContent />}
    </TransitionBox>
  );
}

API

<TransitionBox> 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-transition-box is available under the MIT License.

About

React component for easily transitioning your container size based on children ๐ŸŽ

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published