What problem does it solve?
Barba.js removes the jarring experience of full page reloads by making multi-page sites feel like single-page applications through animated, seamless navigation.
Core Features & Use Cases
- Fluid SPA-like navigation: Hijacks internal link clicks, fetches new content, and swaps containers without full reloads for a polished user experience.
- Lifecycle hooks for precise control: Use
beforeLeave, leave, beforeEnter, enter, and afterEnter to coordinate animations and per-page logic with deterministic timing.
- Route and namespace-aware transitions: Apply different transitions per
data-barba-namespace or by route when using @barba/router, enabling context-specific effects (e.g., home→product vs product→product).
- GSAP-ready animation workflows: Works with GSAP (and patterns like
gsap-scrolltrigger) to implement fade, slide, crossfade (sync), and timeline-driven transitions.
- Performance-friendly enhancements: Supports prefetching patterns (via
@barba/prefetch) and common best practices to reduce flicker and layout shifts during transitions.
Quick Start
Use the barba-js skill to implement GSAP-powered page transitions by wiring your app’s persistent wrapper and dynamic container structure to Barba’s hooks and transition rules.