Giter Club home page Giter Club logo

react-animate-mount's Introduction

React Animate Mount

npm version license

Simple and light wrapper component for sliding (to auto height) and fading animation when children mounts and unmount:

  • Animate - provides sliding and fading animation for single component when mount & umount
  • AnimateGroup - provides animation for items entering & leaving a list.

Gif Demo

Install

$ yarn add react-animate-mount

Demos

Animate

Help animate single component when mount & umount

Usage

/** Before **/
this.state.show ? {childen} : null;

/** After **/
import { Animate } from 'react-animate-mount'

<Animate show={this.state.show}>
  {childen}
</Animate>

Props

Name Type Description
show boolean The key boolean that indicate if the children should be mounted
appear ?boolean = false Normally component is not animated when <Animate> mounts, with this flag the child component will animate in on initialization.
duration ?number = 200 The duration you want the animate to last in ms, default to 250
type ?string('slide' or 'fade') = 'slide' Specify animation effect, sliding or pure fading
onAnimateComplete ?function Invokes when component animation finishes.

AnimateGroup

Wraps around a list of item, this provides <Animate> effect to each individual child. As item changes in the list, <AnimateGroup> will animate out removed children and animate in new children correctly.

Please provide unique key to each child. keys are used to identify child between renders

Usage

import { AnimateGroup } from 'react-animate-mount'

<AnimateGroup>
  {items.map(item => (<Item key={item.key} data={item.data} />)}
</AnimateGroup>

Props

Name Type Description
duration ?number = 200 The duration you want the animate to last in ms, default to 250
type ?string('slide' or 'fade') = 'slide' Specify animation effect, sliding or pure fading
onAnimateComplete ?function Invokes when each time animation finishes.

react-animate-mount's People

Contributors

mingruizhang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.