npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

react-animated-components

v4.0.0

Published

Easy-as-pie CSS animations for React

Readme

🥧 react-animated-components 🥧

Easy-as-pie CSS animations for React.

Because animations should be as easy as <Rotate>🥧</Rotate>

Live Demo with Storybook

Built with Typescript. Just one dependency (styled-components 💅).

Install

npm install --save react-animated-components

Use

import { Rotate } from 'react-animated-components'

/** Pie is boring... let's animate it! **/
const BoringPie = () => <span>🥧</span>

/** Pie is more delicious when it's rotating **/
const RotatingPie = () => {
  return (
    <Rotate>
      <BoringPie />
    </Rotate>
  )
}

Scroll down for more examples!

Demo

jtschoonhoven.github.io/react-animated-components

High-Level Component API

<Rotate>

Spin child elements around their midpoint.

Note that the actual midpoint of an element may not be visually obvious: if it's making your element travel in a crazy circle, consider ajusting your element's width, or set the inline property.

Props:

  • ccw [boolean]: If true, rotates counter-clockwise (default false)

Sub-components:

  • <RotateCw>
  • <RotateCcw>

<Fade>

Animates the opacity of child elements.

This will not cause adjacent elements to reflow except when the element first enters or exits the DOM.

Props:

  • out [boolean]: If true, fades out and exits the DOM (default false)

Sub-components:

  • <FadeIn>
  • <FadeOut>

<Slide>

Animates the location of child elements so that they enter or exit from the given direction.

This will not cause adjacent elements to reflow except when the element first enters or exits the DOM.

Props:

  • out [boolean]: If true, slides out and exits the DOM (default false)
  • fade [boolean]: If true, adds a fade animation
  • up [boolean]: Slide up
  • down [boolean]: Slide down
  • left [boolean]: Slide left
  • right [boolean]: Slide right
  • direction ["up" | "down" | "left" | "right"]: Slide direction, an alternative to boolean direction props

Sub-components:

  • <SlideInDown>
  • <SlideInUp>
  • <SlideInLeft>
  • <SlideInRight>
  • <SlideOutDown>
  • <SlideOutUp>
  • <SlideOutLeft>
  • <SlideOutRight>

<Wipe>

Animates the width or height of an element for accordion-style effects.

Animating width/height causes adjacent elements to reflow on each tick. This can be useful, but your browser will hate it. Consider the tradeoffs and use your own judgement. This animation is provided as a best-effort as there is currently no way to implement expand/collapse animations that will work for all use cases.

Props:

  • out [boolean]: If true, wipes out and exits the DOM (default false)
  • fade [boolean]: If true, adds a fade animation
  • slide [boolean]: If true, adds a slide animation
  • x [boolean]: Wipe horizontally across
  • direction ["x" | "y"]: Wipe direction, an alternative to boolean direction props

Sub-components:

  • <WipeInY>
  • <WipeInX>
  • <WipeOutY>
  • <WipeOutX>

Common Component API

Animated components all accept the following optional properties.

active

[boolean]: Controls when the animation begins. Except for exit animations, this defaults to true and animations begin automatically on mount. Exit animations do not run until active is set explicitly.

delayMs

[number]: Delays the animation start by the given number of milliseconds.

durationMs

[number]: The total duration (in milliseconds) of one iteration of the animation.

timingFunc

[string]: Defines how animations progress through each cycle. Accepts any valid value of the animation-timing-function CSS property.

iterations

[number | "infinite"]: The number of times to loop the animation, or "infinite".

inline

[boolean]: Toggle the display mode from display:block (the default) to display:inline-block. Inline may be more appropriate for animating icons, or for anything that appears inside a text block. NEVER override this to display:inline as these can't be animated.

onActive

[() => void]: Callback function, called when animation begins. Useful for chaining delayed animations.

onComplete

[() => void]: Callback function, called when animation is complete. Useful for garbage collecting components that have exited, or for composing complex chains of effects.

childAnimation

[React.FC<BaseAnimationProps>]: Wrap another animated component inside the current animation. Both animations will receive the same props. This can be a nice way to reduce boilerplate when combining animations with identical props.

parentAnimation

[React.FC<BaseAnimationProps>]: Same as the childAnimation prop, but the current component becomes the child of the new parent.

Examples

Composing Combined Effects

import { Rotate } from 'react-animated-components'
import { FadeIn } from 'react-animated-components'

// Create a composite effect that fades in a rotating pie
const ComposedFadeInAndRotate = () => {
  return (
    <FadeIn>
      <Rotate>🥧</Rotate>
    </FadeIn>
  )
}

// ...or with `childAnimation` prop
const FadeInAndRotateChildAnimation = ({ children }) => {
  return <FadeIn childAnimation={Rotate}>🥧</FadeIn>
}

Timed Transitions

import { SlideInDown } from 'react-animated-components'
import { FadeOut } from 'react-animated-components'

// Slide in a pie from above, then fade out after 3 seconds
const SlideInAndFadeout = () => {
  return (
    <FadeOut delayMs={3000}>
      <SlideInDown durationMs={500}>🥧</SlideInDown>
    </FadeOut>
  )
}

Chained Transitions

import { SlideInDown } from 'react-animated-components'
import { FadeOut } from 'react-animated-components'

// Wait for the slide entrance to complete before exiting
const SlideInAndFadeout = () => {
  const [didEnter, setDidEnter] = React.useState(false)
  const onDidEnter = () => setDidEnter(true)
  return (
    <FadeOut active={didEnter}>
      <SlideInDown onComplete={onDidEnter}>🥧</SlideInDown>
    </FadeOut>
  )
}

Custom Animations

import { keyframes } from 'styled-components'
import { animationFactory } from 'react-animated-components'

const myKeyframes = keyframes`
  from { transform: rotate(359deg); }
  to { transform: rotate(0deg); }
`

// Use the animationFactory to create a reausable animated component
const CustomAnimation = animationFactory({ keyframes: myKeyframes })

// Use custom animations just like any other animated component
const UseCustomAnimation = () => {
  return <CustomAnimation durationMs={500}>🥧</CustomAnimation>
}