Svelte-Animate: Guide #

Svelte Animate is a lightweight Svelte component that brings Animate.css into your app with extra power and accessibility. It goes beyond standard Svelte transitions with sequential effects, flexible triggers, motion preferences, and fine-grained timing controlβ€”all while staying simple to use.

Feature Details #

  • 🎯 Simple wrapper for Animate.css – 75+ animations ready to go
  • πŸ”— Sequence support – chain multiple effects in order
  • πŸŽ› Flexible triggers – hover, click, auto, or combined
  • ⚑ Lightweight – no dependencies beyond Animate.css
  • β™Ώ Accessible by design:
  • Keyboard support (Enter/Space)
  • Screen reader announcements
  • Honors prefers-reduced-motion
  • Proper ARIA roles and live regions
    • βš™οΈ Customization options: duration, delay, per-animation settings, repeats
    • 🎭 Extra controls – hide before/after animations, optional replay button
    • πŸ› Debug mode for development

Installation #

Usage #

Basic usage #

Custom usage #

Props #

PropTypeDefaultDescription
childrenSnippetRequiredThe content to be animated
animationsAnimationConfig[] | AnimationType[] | AnimationTypebounceThe animation effects to apply
trigger'hover' | 'click' | 'both' | 'auto'hoverWhat triggers the animation
durationnumber1000Default animation duration (ms)
hideBetweenbooleanfalseWhether to hide element between animations
hideEndbooleanfalseWhether to hide element after animation sequence
delaynumber0Default delay before animations start (ms)
repeat'1' | '2' | '3' | 'infinite'1Number of times to repeat the animation
pauseDurationnumber0Default pause between animations (ms)
classstring''Additional CSS classes for the container
debugbooleanfalseEnable debug mode with visible status updates
showReplayButtonbooleanfalseShow replay button after animation ends

Animation Configuration #

When using the animations prop with detailed configuration:

Accessibility Features #

  • - Full keyboard navigation support
  • - Enter and Space keys trigger animations for click/both triggers
  • - Proper focus management
  • - Event prevention to avoid unexpected behavior

Screen Reader Support #

  • - Descriptive ARIA labels for animated elements
  • - Animation completion announcements using aria-live regions
  • - Clear state changes communication

Motion Preferences #

  • - Automatically detects and respects prefers-reduced-motion settings
  • - Gracefully degrades to no animation when reduced motion is preferred
  • - Maintains content visibility and functionality

Examples #

Basic Example #

Click Animation with Delay #

Complex Animation Sequence #

Debug Mode Example #

Animation Types #