barba-js

Implement smooth page transitions between website pages using Barba.js and GSAP.

Updated Jun 30, 2026
One-click install
npx skills add https://github.com/ayofemiade/cleva --skill barba-js-ayofemiade
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: barba-js
Source: https://github.com/ayofemiade/cleva/tree/main/.claude/skills/barba-js
Command: npx skills add https://github.com/ayofemiade/cleva --skill barba-js-ayofemiade

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires @barba/core, @barba/router, @barba/prefetch, @barba/head, @barba/css, gsap, vite, and includes scripts (resource) and references (resource) and assets (resource) components.

What problem does it solve? Multi-page websites traditionally reload the entire page on every navigation, causing jarring flashes and lost scroll state. This Skill helps you implement Barba.js to intercept navigation, fetch pages via AJAX, and animate transitions so multi-page sites behave like Single Page Applications. ## Core Features & Use Cases - Transition Implementation: Build fade, slide, scale, stagger, and curtain transitions using Barba's 11 lifecycle hooks with GSAP animations. - View & Route Management: Configure namespace-based views and @barba/router rules for page-specific logic and conditional transitions. - Project Scaffolding: Generate complete starter projects with the project_setup.py script or custom transition code with transition_generator.py. - Use Case: You are building a portfolio site with separate HTML pages and want a crossfade effect when visitors click between Home, About, and Contact, while keeping the header persistent and tracking pageviews in analytics. ## Quick Start Use the barba-js skill to add a fade page transition to my multi-page website with GSAP animations.

Frequently Asked Questions about barba-js

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add page transitions to a multi-page website?▼

Use Barba.js to intercept link clicks and swap page containers with animated transitions. Add data-barba="wrapper" and data-barba="container" attributes to your HTML, then define leave and enter hooks with GSAP animations in barba.init().

How to use Barba.js with GSAP for animations?▼

Return GSAP tweens or timelines from Barba's leave and enter hooks, since GSAP animations return promises that Barba awaits. Use gsap.set() in beforeEnter to establish initial states and prevent content flashing before the enter animation.

Why does my Barba.js transition complete instantly without animating?▼

The transition hook is not returning a promise, so Barba does not wait for the animation. Fix it by returning the GSAP tween directly or declaring the hook as async and awaiting the animation.

Does Barba.js update the page title and meta tags on navigation?▼

Barba.js only swaps the container content by default, so head tags stay stale. Install the @barba/head plugin to automatically update title, meta, and link tags, or update them manually in the after hook.

What is the difference between sync and async transitions in Barba.js?▼

Async mode (default) runs the leave animation, swaps containers, then runs enter. Sync mode with sync: true runs leave and enter simultaneously for crossfade effects, but requires absolute positioning to prevent layout shift.

When should I not use Barba.js for page transitions?▼

Avoid Barba.js when building a true SPA with React or Vue, where framework routers like Next.js routing or Framer Motion fit better. It also adds complexity for simple sites where full reloads are acceptable.