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

@simple-motion/react

v0.0.2

Published

A lightweight React transition library for animating component lifecycle changes.

Readme

@simple-motion/react

codecov

A lightweight React transition library for animating component lifecycle changes.


Features

  • Declarative API: Simple and intuitive API for handling transitions.
  • Lifecycle Control: Hooks for each phase of the transition (entering, entered, exiting, exited).
  • CSS Transitions: Easily apply CSS classes for animations.
  • Group Animations: Animate a list of components as they are added or removed.
  • Switchable Animations: Seamlessly transition between two components.
  • Lightweight: Small and efficient with zero runtime dependencies, ensuring a minimal impact on your bundle size.

Documentation

Installation

npm install @simple-motion/react
pnpm add @simple-motion/react

Usage

Transition

The Transition component is the foundation of the library, allowing you to animate a component's mount and unmount lifecycle.

import { Transition } from '@simple-motion/react';

function App() {
  const [inProp, setInProp] = useState(true);

  return (
    <>
      <button onClick={() => setInProp(!inProp)}>
        Click to {inProp ? 'Exit' : 'Enter'}
      </button>
      <Transition in={inProp} timeout={300}>
        {phase => (
          <div style={{
            transition: `opacity 300ms`,
            opacity: phase === 'exiting' || phase === 'exited' ? 0 : 1
          }}>
            I'm a fade Transition!
          </div>
        )}
      </Transition>
    </>
  );
}

CSSTransition

The CSSTransition component extends the Transition component, providing a way to apply CSS classes for animations.

import { CSSTransition } from '@simple-motion/react';
import './styles.css';

function App() {
  const [inProp, setInProp] = useState(true);

  return (
    <>
      <button onClick={() => setInProp(!inProp)}>
        Click to {inProp ? 'Exit' : 'Enter'}
      </button>
      <CSSTransition in={inProp} timeout={300} classNames="fade">
        <div>I'm a CSS Transition!</div>
      </CSSTransition>
    </>
  );
}

And in your CSS file:

.fade-enter {
  opacity: 0;
}
.fade-enter-active {
  opacity: 1;
  transition: opacity 300ms;
}
.fade-exit {
  opacity: 1;
}
.fade-exit-active {
  opacity: 0;
  transition: opacity 300ms;
}

TransitionGroup

The TransitionGroup component manages a set of Transition or CSSTransition components in a list.

import { TransitionGroup, CSSTransition } from '@simple-motion/react';
import './styles.css';

function App() {
  const [items, setItems] = useState([
    { id: 1, text: 'Item 1' },
    { id: 2, text: 'Item 2' }
  ]);

  const addItem = () => {
    const id = Date.now();
    setItems(prevItems => [...prevItems, { id, text: `Item ${id}` }]);
  };

  const removeItem = (id) => {
    setItems(prevItems => prevItems.filter(item => item.id !== id));
  };

  return (
    <>
      <button onClick={addItem}>Add Item</button>
      <TransitionGroup>
        {items.map(({ id, text }) => (
          <CSSTransition key={id} timeout={500} classNames="fade">
            <div>
              {text}
              <button onClick={() => removeItem(id)}>Remove</button>
            </div>
          </CSSTransition>
        ))}
      </TransitionGroup>
    </>
  );
}

TransitionSwitch

The TransitionSwitch component is used to transition between two components.

import { TransitionSwitch, CSSTransition } from '@simple-motion/react';
import './styles.css';

function App() {
  const [showFirst, setShowFirst] = useState(true);

  return (
    <>
      <button onClick={() => setShowFirst(!showFirst)}>
        Switch
      </button>
      <TransitionSwitch>
        <CSSTransition
          key={showFirst ? 'first' : 'second'}
          timeout={500}
          classNames="fade"
        >
          <div>{showFirst ? 'First Component' : 'Second Component'}</div>
        </CSSTransition>
      </TransitionSwitch>
    </>
  );
}

Development

To get started with developing simple-motion-react:

  1. Clone the repository
  2. Install dependencies: pnpm install
  3. Run Storybook: pnpm storybook
  4. Run tests: pnpm test

License

This project is licensed under the MIT License. See the LICENSE file for details.