Options

Definition of all available options for barba.init.

For a deep dive into the Barba Core class, please see the developer API.

Summary

  1. Syntax
  2. Definition

Syntax

Here is short syntax of all options with their defaults.

1
2
3
4
5
6
7
8
9
10
11
12
13
barba.init({
cacheFirstPage: false,
cacheIgnore: false,
debug: false,
logLevel: 'off',
prefetchIgnore: false,
prevent: null,
preventRunning: false,
schema: [[SchemaAttribute]],
timeout: 2e3,
transitions: [],
views: [],
})

Definition

Barba can take some arguments in the initialization step:

Name Type Description
cacheFirstPage boolean Disable cache on the first rendered page, see cacheFirstPage strategy
cacheIgnore IgnoreOption Disable cache or ignore some routes, see cacheIgnore strategy
debug boolean Enable debug mode
logLevel keyof LogLevels Set custom log level for fine-grained debugging
prefetchIgnore IgnoreOption Disable prefetch or ignore routes, see prefetchIgnore strategy
prevent PreventCheck Set custom prevent check
preventRunning boolean Prevent click when transition is running, see preventRunning strategy
requestError RequestCustomError Set custom request error
schema ISchemaAttribute Set custom schema to override data-barba attributes
timeout number Request timeout
transitions ITransitionPage[] Array of Transitions
views IView[] Array of Views

All arguments inherit from IBarbaOptions interface.