🎨
UI Component1M+/wkMIT

@react-spring/web

React Spring is a spring-physics-based animation library for React that covers most UI animation needs with a natural, fluid feel. Unlike duration-based animati

Installation

npm
npm install @react-spring/web
yarn
yarn add @react-spring/web
pnpm
pnpm add @react-spring/web

Import

ESM
import { useSpring, animated } from '@react-spring/web';

Quick Example

usage
import { useSpring, animated } from '@react-spring/web';

function FadeIn() {
  const springs = useSpring({
    from: { opacity: 0, y: 50 },
    to: { opacity: 1, y: 0 },
  });

  return (
    <animated.div style={springs}>
      <h2>Hello Spring</h2>
    </animated.div>
  );
}

About @react-spring/web

React Spring is a spring-physics-based animation library for React that covers most UI animation needs with a natural, fluid feel. Unlike duration-based animations that move at a constant rate, spring animations simulate physical springs with configurable mass, tension, and friction, producing motion that feels organic and responsive. The library provides hooks for different animation patterns: useSpring for single element animations, useSprings for lists of elements, useTrail for staggered sequences, useTransition for mount/unmount animations, and useChain for orchestrating multiple animations in sequence. Each hook returns animated values and a ref, which are applied to animated.div (or any animated.* element) components that efficiently interpolate values outside React's render cycle for optimal performance. React Spring supports animating any numeric value, colors, transforms, SVG paths, and custom interpolations. The library handles interruption gracefully — starting a new animation while one is in progress produces smooth transitions rather than jarring jumps. React Spring works with React DOM and React Native through separate packages. While Framer Motion has become more popular for its simpler API, React Spring's physics-based approach produces superior animation quality for complex, interactive animations.

Quick Facts

Package@react-spring/web
CategoryUI Component
Weekly Downloads1M+
LicenseMIT
Installnpm install @react-spring/web

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.