Toggle a class

The button toggles the class from data-bs-value on itself.

Remove an existing class

When the element already has the class, the first click removes it.

Target element

Point data-bs-target at another element. The value lives on the target.

The button toggles bg-primary-lt here.

Multiple elements

A selector with many matches toggles every one, each with its own value.

Toggles bg-blue-lt
Toggles bg-green-lt
Toggles bg-orange-lt

Toggle an attribute

Set data-bs-attribute to toggle an attribute instead, here hidden.

Now you see me.

Disable a form

Toggle disabled on a fieldset to lock every control inside.