What are data-bs-* attributes in Bootstrap?

Bootstrap reads attributes that start with data-bs-. They start a component and give its target and options, so for many components you do not write any JavaScript.

AttributeMeaning
data-bs-toggleWhich plugin to start (modal, collapse, dropdown, tab, tooltip, popover, offcanvas, button)
data-bs-targetSelector of the element to control (or use href on links)
data-bs-dismissCloses an alert, modal, toast or offcanvas
data-bs-OPTIONAn option, like data-bs-backdrop="static"

In Bootstrap 4 the attributes were data-toggle and so on. See Bootstrap JavaScript.


Learn more about the similar topics:
Tutorials
No Content Found.
Exercises & Assignments
No Content Found.
Interview Questions & Answers
No Content Found.