@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 install @react-spring/web
yarn add @react-spring/web
pnpm add @react-spring/web
Import
import { useSpring, animated } from '@react-spring/web';Quick Example
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 |
| Category | UI Component |
| Weekly Downloads | 1M+ |
| License | MIT |
| Install | npm install @react-spring/web |
Related Packages
Framer Motion is the most popular animation library for React, providing a simple declarative API fo…
React is the most popular JavaScript library for building user interfaces, developed and maintained …
Lottie Web is a library for rendering Adobe After Effects animations exported as JSON files through …
Three.js is the most popular JavaScript library for creating and displaying 3D graphics in web brows…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.