# barba\.js

[BASE product page](<https://base.akulich.dev/en/library/barba-js/>) · [Resource](<https://barba.js.org/>)

ID: barba\-js · Language: en
Schema version: 1 · Data version: cbbe7123b47a5ae80983

This is editorial data. An unknown field neither confirms nor rules out a capability.
dataVersion is a dataset fingerprint, not evidence of a recent fact check.

Page transitions for conventional websites without a full reload: it replaces the content container and lets you coordinate navigation animations\.

## Type

Development library / tool

## Entry type

library

## Separate catalog

No

## [Access conditions](<https://base.akulich.dev/en/library/barba-js/#resource-access>)

free

## [What you can use for free](<https://base.akulich.dev/en/library/barba-js/#resource-access>)

barba\.js code is available free of charge for local and commercial projects, subject to its license\.

## [Paid features and costs](<https://base.akulich.dev/en/library/barba-js/#resource-access>)

This library does not require a paid plan\. Development and hosting of the finished application are separate from the free code license\.

## [Access and limitations](<https://base.akulich.dev/en/library/barba-js/#resource-access>)

barba\.js code is available free of charge for local and commercial projects, subject to its license\. This library does not require a paid plan\. Development and hosting of the finished application are separate from the free code license\.

## [Use cases](<https://base.akulich.dev/en/library/barba-js/#resource-tasks>)

- UI or SVG animation
- Smooth website content transitions
- Coordinate content exit and entry animations when navigating between pages
- Replace the page container without fully reloading a conventional website

## Category IDs

- motion

## Subcategory IDs

- motion\.web

## Tags

- JavaScript
- DOM
- web

## Also known as

- barbajs/barba

## [Selection purpose](<https://base.akulich.dev/en/library/barba-js/#resource-selection>)

UI or SVG animation

## [Choose this when](<https://base.akulich.dev/en/library/barba-js/#resource-selection>)

- UI or SVG animation
- Smooth website content transitions
- Coordinate content exit and entry animations when navigating between pages

## [Consider alternatives when](<https://base.akulich.dev/en/library/barba-js/#resource-selection>)

- When choosing for this topic, compare barba\.js with Moti\. A candidate to compare: both product pages list the use case “UI or SVG animation”\. Implementation approach and compatibility are checked separately\.
- When choosing for this topic, compare barba\.js with Rough Notation\. A candidate to compare: both product pages list the use case “UI or SVG animation”\. Implementation approach and compatibility are checked separately\.

## [Requirements](<https://base.akulich.dev/en/library/barba-js/#resource-selection>)

- Prepared wrapper/container HTML markup; the guide assumes knowledge of HTML, CSS, and JavaScript\.

## [Limitations](<https://base.akulich.dev/en/library/barba-js/#resource-selection>)

- Costs and limits of free use: This library does not require a paid plan\. Development and hosting of the finished application are separate from the free code license\.
- Terms of use: MIT: permits free commercial use, modification, and distribution of the code, with the license text and copyright notice retained\. The code is provided without warranties; check third\-party widget and service terms separately\.
- Inline scripts do not restart automatically after a page change through Barba\.

## [Questions before use](<https://base.akulich.dev/en/library/barba-js/#resource-faq>)

### What can you use for free in barba\.js?

barba\.js code is available free of charge for local and commercial projects, subject to its license\.

### What additional costs might arise with barba\.js?

This library does not require a paid plan\. Development and hosting of the finished application are separate from the free code license\.

### What terms of use matter for barba\.js?

MIT: permits free commercial use, modification, and distribution of the code, with the license text and copyright notice retained\. The code is provided without warranties; check third\-party widget and service terms separately\.

### How do you get started with barba\.js?

Check the project's stack and version against the current barba\.js documentation; add the package or the required source component\. For page transitions, prepare a wrapper and nested container on each page; use namespace to select transition rules and Views\. Implement the selected workflow using the provided data, adapting styles and states to the project\. Align the old container's exit and the new container's entry with the lifecycle\. If animating SVG or other elements, check their separate initialization after navigation\. Check the result in the target environment, remove demo data, and retain notices required by the license\. One possible check is several transitions back and forth, correct body classes, functioning forms and widgets, and no accumulated listeners or ScrollTrigger instances\.

### How do I prepare markup for barba\.js?

Content to be replaced is placed in data\-barba="container" inside data\-barba="wrapper"\. Elements outside the container are not replaced; namespace helps select transitions and Views\.

### What happens to scripts after a transition?

The documentation warns that inline scripts do not execute again during Barba navigation\. Third\-party widget integration and cleanup of previous instances must use lifecycle hooks or Views\.

### Why does the header or footer not change after a transition?

Barba updates the container, while elements inside the wrapper but outside the container remain unchanged\. If part of the header, navigation, or footer must change with the page, the documentation recommends placing it in the replaced container; the wrapper must encompass the container\.

### Why do scroll effects accumulate after several transitions?

The documentation warns about repeated ScrollTrigger instances and shows creating them on entry through Views and cleaning them up after exit\. One possible check is to align each widget's creation and destruction with the lifecycle and avoid duplicating global handlers\.

### Are WordPress body classes updated automatically?

If body is outside the replaced container, its classes remain\. For WordPress, the guide shows manually updating classes from next\.html and asks users to adapt the example to their needs\. This is a separate integration task that must be checked across all page templates\.

## Related resources selected by editors

- moti: A candidate to compare: both product pages list the use case “UI or SVG animation”\. Implementation approach and compatibility are checked separately\.
- rough\-notation: A candidate to compare: both product pages list the use case “UI or SVG animation”\. Implementation approach and compatibility are checked separately\.
- tsparticles: A candidate to compare: both product pages list the use case “UI or SVG animation”\. Implementation approach and compatibility are checked separately\.

## Sources for the selection guide

- [https://barba\.js\.org/](<https://barba.js.org/>)
- [https://github\.com/barbajs/barba](<https://github.com/barbajs/barba>)
- [https://github\.com/barbajs/barba/blob/main/README\.md](<https://github.com/barbajs/barba/blob/main/README.md>)
- [https://github\.com/barbajs/barba/blob/main/LICENSE\.md](<https://github.com/barbajs/barba/blob/main/LICENSE.md>)
- [https://barba\.js\.org/docs/getstarted/intro/](<https://barba.js.org/docs/getstarted/intro/>)
- [https://barba\.js\.org/docs/getstarted/markup/](<https://barba.js.org/docs/getstarted/markup/>)
- [https://barba\.js\.org/docs/advanced/third\-party/](<https://barba.js.org/docs/advanced/third-party/>)

## [Possible workflow](<https://base.akulich.dev/en/library/barba-js/#resource-scenario>)

UI or SVG animation with barba\.js\.

A possible workflow; this is not a report of hands-on testing.

## Before you start

- A working JavaScript; DOM project and a specific use case: UI or SVG animation\.
- A design, interface states, or dataset; target screens and accessibility requirements\.

## Steps

1. Check the project's stack and version against the current barba\.js documentation; add the package or the required source component\. For page transitions, prepare a wrapper and nested container on each page; use namespace to select transition rules and Views\.
2. Implement the selected workflow using the provided data, adapting styles and states to the project\. Align the old container's exit and the new container's entry with the lifecycle\. If animating SVG or other elements, check their separate initialization after navigation\.
3. Check the result in the target environment, remove demo data, and retain notices required by the license\. One possible check is several transitions back and forth, correct body classes, functioning forms and widgets, and no accumulated listeners or ScrollTrigger instances\.

## Check your result

- The example works in the chosen tech stack, including target dimensions and input errors\.
- Dependency size, keyboard behavior, and reduced motion suit the task; license terms are met\.

## [License](<https://base.akulich.dev/en/library/barba-js/#resource-license>)

MIT: permits free commercial use, modification, and distribution of the code, with the license text and copyright notice retained\. The code is provided without warranties; check third\-party widget and service terms separately\.

## License explanations for the specified scope

### MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed\-source commercial product\. When sharing copies or substantial portions of the code, retain the license text and copyright notice\. You do not need to open\-source your entire project; the author provides no warranties\.

[License terms](<https://opensource.org/license/mit>)

## [Sources](<https://base.akulich.dev/en/library/barba-js/#resource-sources>)

- [Official website](<https://barba.js.org/>)
- [Source code](<https://github.com/barbajs/barba>)
- [Documentation and use](<https://github.com/barbajs/barba/blob/main/README.md>)
- [License](<https://github.com/barbajs/barba/blob/main/LICENSE.md>)
- [Official source](<https://barba.js.org/docs/getstarted/intro/>)
- [Official source](<https://barba.js.org/docs/getstarted/markup/>)
- [Official source](<https://barba.js.org/docs/advanced/third-party/>)

## Editorial review date

2026\-10\-06

## Editorial review scope

Purpose, published primary source code/documentation, and license terms were reviewed\. An example was not run in a local project\.

Dates refer to the stated editorial review, not hands-on testing, a product update, or a recent review of all sources.
