Fade In
ui-beats/fade-inFreeComponent
The FadeIn component creates a smooth fade-in animation for its children when they enter the viewport.
Install it
npx shadcn@latest add https://uibeats.com/r/fade-in.jsonSource
1"use client";2import React from "react";3import { motion, useInView, type Variants } from "motion/react";45interface FadeInProps {6 children: React.ReactNode;7 delay?: number;8 duration?: number;9 className?: string;10 once?: boolean;11}1213const FadeIn: React.FC<FadeInProps> = ({14 children,15 delay = 0,16 duration = 0.5,17 className = "",18 once = true,19}) => {20 const ref = React.useRef<HTMLDivElement>(null);21 const isInView = useInView(ref, { once, amount: 0.1 });2223 const variants: Variants = {24 hidden: { opacity: 0 },25 visible: {26 opacity: 1,27 transition: {28 duration: duration,29 delay: delay,30 ease: "easeOut",31 },32 },33 };3435 return (36 <motion.div37 ref={ref}38 initial="hidden"39 animate={isInView ? "visible" : "hidden"}40 variants={variants}41 className={className}42 >43 {children}44 </motion.div>45 );46};4748export default FadeIn;
What it pulls in
npm packages
Files it writes
More from ui-beats
All 34 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Animated Beamanimated-beam | ui-beats | Components | Free | 1 dep | |
| Animated Listanimated-list | ui-beats | Components | Free | 1 dep | |
| Border Beamborder-beam | ui-beats | Components | Free | 1 dep | |
| Bouncebounce | ui-beats | Components | Free | 1 dep | |
| Card Stackcard-stack | ui-beats | Components | Free | 1 dep | |
| Dockdock | 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 |
