Get started with scroll animations
Awesome Reveal animates elements when they scroll into view. Each framework package uses the same core. The core uses the Intersection Observer API and the Web Animations API of the browser, and it has no dependencies.
Requirements
Section titled “Requirements”| Framework | Framework version | Node.js |
|---|---|---|
| React | 18 or 19 | 20.19 or later |
| Vue | 3.5 or later | 20.19 or later |
| Astro | 6 or 7 | 22.12 or later |
| JavaScript | 20.19 or later |
The packages are ES modules only. They include their TypeScript types.
Install the package
Section titled “Install the package”Install the package for your framework.
pnpm add @awesome-reveal/reactpnpm add @awesome-reveal/vuepnpm add @awesome-reveal/astropnpm add @awesome-reveal/coreWith npm, yarn or bun, use npm install, yarn add or bun add, followed by the package name.
Reveal an element
Section titled “Reveal an element”Wrap the element in Reveal. With @awesome-reveal/core, call reveal() with a CSS selector, an element or a list of elements.
import { Reveal } from "@awesome-reveal/react";
export function HeroTitle() { return ( <Reveal> <h1>Hello</h1> </Reveal> );}<script setup>import { Reveal } from "@awesome-reveal/vue";</script>
<template> <Reveal> <h1>Hello</h1> </Reveal></template>---import { Reveal } from "@awesome-reveal/astro";---
<Reveal> <h1>Hello</h1></Reveal>import { reveal } from "@awesome-reveal/core";
reveal("h1");When the element enters the viewport, it fades in and moves up 24 pixels. The entrance plays one time. You do not import a stylesheet.
Animate a list
Section titled “Animate a list”Cascade reveals its direct children one after the other. The interval option sets the time between the start of two children, in milliseconds. The default is 80.
import { Cascade } from "@awesome-reveal/react";
export function FeatureList() { return ( <Cascade as="ul" interval={120}> <li>Small</li> <li>Native</li> <li>Accessible</li> </Cascade> );}<script setup>import { Cascade } from "@awesome-reveal/vue";</script>
<template> <Cascade as="ul" :interval="120"> <li>Small</li> <li>Native</li> <li>Accessible</li> </Cascade></template>---import { Cascade } from "@awesome-reveal/astro";---
<Cascade as="ul" interval={120}> <li>Small</li> <li>Native</li> <li>Accessible</li></Cascade>import { cascade } from "@awesome-reveal/core";
cascade("ul.features", { interval: 120 });What happens when the page loads
Section titled “What happens when the page loads”- The React, Vue and Astro packages render the element as hidden in the server HTML, so the element does not flash before the script runs. Hydrate the reveal content eagerly. See The 5 second hold.
@awesome-reveal/coredoes not hide content before your script callsreveal().- If the user asks for reduced motion, the content shows at once, with no animation.
- In older browsers, the content does not stay hidden.
Next steps
Section titled “Next steps”- Choose the entrance: fade and slide in from a side, or zoom, rotate and blur.
- Options: all the options, with their types and default values.
- Frameworks: add scroll animations to React, Next.js, Vue, Vue SSR and Nuxt, Astro or plain JavaScript.