Bounce
ui-beats/bounceFreeComponent
The Bounce component adds a playful, elastic animation to its children when they enter the viewport.
Install it
npx shadcn@latest add https://uibeats.com/r/bounce.jsonSource
1"use client";2import React from "react";3import { motion, useInView, type Variants } from "motion/react";45interface BounceProps {6 children: React.ReactNode;7 delay?: number;8 duration?: number;9 bounceHeight?: number;10 className?: string;11 once?: boolean;12}1314const Bounce: React.FC<BounceProps> = ({15 children,16 delay = 0,17 duration = 0.5,18 bounceHeight = 20,19 className = "",20 once = true,21}) => {22 const ref = React.useRef<HTMLDivElement>(null);23 const isInView = useInView(ref, { once, amount: 0.1 });2425 const variants: Variants = {26 hidden: { opacity: 0, y: bounceHeight },27 visible: {28 opacity: 1,29 y: 0,30 transition: {31 delay,32 duration,33 type: "spring",34 stiffness: 200,35 damping: 10,36 },37 },38 };3940 return (41 <motion.div42 ref={ref}43 initial="hidden"44 animate={isInView ? "visible" : "hidden"}45 variants={variants}46 className={className}47 >48 {children}49 </motion.div>50 );51};5253export default Bounce;
What it pulls in
npm packages
Files it writes
More from ui-beats
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | ui-beats | Components | Free | 1 dep | |
| Dockdock | ui-beats | Components | Free | 1 dep | |
| Fade Infade-in | ui-beats | Components | Free | 1 dep | |
| Fade In Unblurfade-in-unblur | ui-beats | Components | Free | 1 dep | |
| Flip Cardflip-card | ui-beats | Components | Free | 2 deps | |
| Glowing Cardglowing-card | ui-beats | Components | Free | 1 dep | |
| Gradient Flowgradient-flow | ui-beats | Components | Free | 1 dep | |
| Gravity Text Swapgravity-text-swap | ui-beats | Components | Free | 1 dep |
