Component
Fade In
An animated component that fades in entire elements (divs, sections, images, etc.) with smooth GSAP animations.
Installation
Interactive Demo
Try out different prop combinations and default variants and see the results in real-time.
In your own project you can add your own variants and expand on this starting point.
Card Title
This entire card fades in with the selected animation.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "fade" | "slideUp" | "slideDown" | "slideLeft" | "slideRight" | "scale" | "blur" | "fade" | The animation variant to use, add your own variants as needed |
| duration | "fast" | "normal" | "slow" | "normal" | Preset animation duration |
| customDuration | number | - | Custom animation duration in seconds (overrides duration prop) |
| delay | number | 0 | Delay before animation starts (in seconds) |
| triggerOnView | boolean | true | Whether to trigger animation when element enters viewport |
| skipDelayOnOutOfView | boolean | false | Whether to skip the delay if the element is initially out of view |
| once | boolean | true | Whether animation should only play once |
| as | React.ElementType | "div" | The element to render as |
| asChild | boolean | false | Merge props with child element |
Source Code
The complete source code for this component.