What is the difference between Bootstrap data-toggle vs data-bs-toggle attributes?

This comes fro PR 31827 and commit 418f17e (Nov. 2020, bootstrap v5.0.0-beta1)

It fixes issue 29479 “Add a namespace for data-* attribute?”

As explained in “What’s New in Bootstrap 5 / Change in data attributes” from Shahed Nasser:

Bootstrap 5 has changed the naming of the data attributes that are generally used by its components that use JavaScript as part of their functionality.

Previously, most components that relied on some JavaScript functionalities would have data attributes starting with data-.

In Bootstrap 5, data attributes for these components now start with data-bs to easily namespace Bootstrap attributes.

Commit b38110a concurs:

Data attributes for all JavaScript plugins are now namespaced to help distinguish Bootstrap functionality from third parties and your own code.
For example, we use data-bs-toggle instead of data-toggle.

Leave a Comment