{"schemaVersion":1,"id":"barba-js","name":"barba.js","locale":"en","canonicalUrl":"https://base.akulich.dev/en/library/barba-js/","officialUrl":"https://barba.js.org/","isCatalog":false,"description":"Page transitions for conventional websites without a full reload: it replaces the content container and lets you coordinate navigation animations.","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"],"categoryIds":["motion"],"subcategoryIds":["motion.web"],"tags":["JavaScript","DOM","web"],"aliases":["barbajs/barba"],"platforms":[],"stack":[],"compatibility":null,"pricing":"free","freeUsage":"barba.js code is available free of charge for local and commercial projects, subject to its license.","paidUsage":"This library does not require a paid plan. Development and hosting of the finished application are separate from the free code license.","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.","selectionGuide":{"purpose":"UI or SVG animation","chooseWhen":["UI or SVG animation","Smooth website content transitions","Coordinate content exit and entry animations when navigating between pages"],"considerInstead":["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":["Prepared wrapper/container HTML markup; the guide assumes knowledge of HTML, CSS, and JavaScript."],"limitations":["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."],"faq":[{"question":"What can you use for free in barba.js?","answer":"barba.js code is available free of charge for local and commercial projects, subject to its license."},{"question":"What additional costs might arise with barba.js?","answer":"This library does not require a paid plan. Development and hosting of the finished application are separate from the free code license."},{"question":"What terms of use matter for barba.js?","answer":"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."},{"question":"How do you get started with barba.js?","answer":"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."},{"question":"How do I prepare markup for barba.js?","answer":"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."},{"question":"What happens to scripts after a transition?","answer":"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."},{"question":"Why does the header or footer not change after a transition?","answer":"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."},{"question":"Why do scroll effects accumulate after several transitions?","answer":"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."},{"question":"Are WordPress body classes updated automatically?","answer":"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":[{"id":"moti","reason":"A candidate to compare: both product pages list the use case “UI or SVG animation”. Implementation approach and compatibility are checked separately."},{"id":"rough-notation","reason":"A candidate to compare: both product pages list the use case “UI or SVG animation”. Implementation approach and compatibility are checked separately."},{"id":"tsparticles","reason":"A candidate to compare: both product pages list the use case “UI or SVG animation”. Implementation approach and compatibility are checked separately."}],"sources":["https://barba.js.org/","https://github.com/barbajs/barba","https://github.com/barbajs/barba/blob/main/README.md","https://github.com/barbajs/barba/blob/main/LICENSE.md","https://barba.js.org/docs/getstarted/intro/","https://barba.js.org/docs/getstarted/markup/","https://barba.js.org/docs/advanced/third-party/"]},"selectionCheckedAt":null,"applicationGuide":{"goal":"UI or SVG animation with barba.js.","inputs":["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":["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."],"checks":["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."]},"sources":["https://barba.js.org/","https://github.com/barbajs/barba","https://github.com/barbajs/barba/blob/main/README.md","https://github.com/barbajs/barba/blob/main/LICENSE.md","https://barba.js.org/docs/getstarted/intro/","https://barba.js.org/docs/getstarted/markup/","https://barba.js.org/docs/advanced/third-party/"],"checkedAt":"2026-10-06","reviewScope":"Purpose, published primary source code/documentation, and license terms were reviewed. An example was not run in a local project.","relatedIds":[],"dataVersion":"cbbe7123b47a5ae80983","type":"Development library / tool","kind":"library","pricingNote":"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.","notes":null,"labeledSources":[{"url":"https://barba.js.org/","label":"Official website"},{"url":"https://github.com/barbajs/barba","label":"Source code"},{"url":"https://github.com/barbajs/barba/blob/main/README.md","label":"Documentation and use"},{"url":"https://github.com/barbajs/barba/blob/main/LICENSE.md","label":"License"},{"url":"https://barba.js.org/docs/getstarted/intro/","label":"Official source"},{"url":"https://barba.js.org/docs/getstarted/markup/","label":"Official source"},{"url":"https://barba.js.org/docs/advanced/third-party/","label":"Official source"}],"licenseGuides":[{"id":"mit","title":"MIT — permissive license","scope":null,"summary":"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.","url":"https://opensource.org/license/mit"}],"entryIds":[],"composition":null}