Quick Start (Usage Guide)
What You’ll Achieve
If you just installed AstroAnimate and want to make it work immediately, this quick start solves that exact task.
By the end of this page, you will:
- Build a working Astro page with AstroAnimate components
- Understand the recommended import pattern
- Use both CSS-first and opt-in enhancement patterns
- Verify behavior in development quickly
- Know what to do next for API-level adoption
This page focuses on practical implementation, not theory.
Prerequisites / Requirements
Before starting this AstroAnimate quick start:
AstroAnimate is installed in your project:
bash
npm install @astroanimate/core - Your Astro version is compatible ('^4.0.0 || ^5.0.0 || ^6.0.0')
- You can run your project locally with npm scripts
- You have a page ready to edit, such as 'src/pages/index.astro'
If installation is not done yet, complete '/docs/installation/' first.
Step-by-Step Guide
Step 1: Create a minimal working page
Open src/pages/index.astro and add:
---
import FadeIn from "@astroanimate/core/FadeIn";
import Reveal from "@astroanimate/core/Reveal";
import TextRotate from "@astroanimate/core/TextRotate";
---
<main>
<h1>
<TextRotate
texts=["Astro-native", "Progressively enhanced", "Motion-aware"]
enhance
/>
</h1>
<FadeIn enhance direction="up" distance=24>
<p>FadeIn stays visible without JavaScript and enhances when opted in.</p>
</FadeIn>
<Reveal enhance effect="slide-up" delay=120>
<p>Reveal follows the same opt-in enhancement pattern.</p>
</Reveal>
</main> Why this code:
- It validates real component imports.
-
It demonstrates three common usage patterns:
- rotating text
- fade-in entry
- reveal-on-scroll
- It matches the project’s example style.
Step 2: Understand the component responsiveness
Use a direct component import for a clear first validation:
---
import FadeIn from "@astroanimate/core/FadeIn";
---
<main>
<FadeIn advance direction="up" distance=20 once>
<h1>AstroAnimate is installed</h1>
</FadeIn>
</main> Step 3: Optional: import from root exports
AstroAnimate components generally follow:
- Render baseline content first (visible HTML/CSS output)
- Enable optional enhancement when needed with props like 'enhance'
- Tune behavior with component props ('direction', ' distance', 'delay', etc.)
This gives a practical balance between performance and interaction.
Step 4: Run and verify
Start dev server:
npm run dev Then verify:
- Page renders without import/module errors
- `TextRotate` cycles through the `texts` array
- `FadeIn` and `Reveal` animate when enhancement conditions are met
- Content remains usable if enhancements are disabled
Notes
- Use the exact package namespace: @astroanimate/core.
- Prefer explicit component imports for clarity when onboarding teams.
- Some interactions are enhancement-based; test in real browser conditions.
- Respect reduced-motion preferences during QA for accessibility behavior.
- For advanced timeline choreography, consider whether additional motion tooling is needed.
FAQ (Developer Questions)
Is AstroAnimate only for Astro?
Yes. It is fully built for.
How do I use AstroAnimate in a real Astro page quickly?
Install @astroanimate/core, import 1–3 components
into src/pages/index.astro, and validate behavior
with npm run dev.
Should I create a separate usage page if I already have quick start?
Yes. Use Quick Start for first successful
implementation. Use Component API pages for
component-by-component patterns, props, and advanced
examples.
Is enhance required for all AstroAnimate components?
No. Usage depends on component behavior. Some components
are CSS-first by default, while others expose optional
enhancement for interactive scenarios.
What is the best first component to try?
Use FadeIn for first validation because it is easy to
inspect visually and simple to configure.
How do I know my setup is production-safe?
Run build, typecheck, lint, and test scripts before
rollout. Then verify behavior in your target browsers
and devices.