You can automatically apply classes or attributes to buttons when their assigned theme is currently active. These options are button-only and are ignored on <select> and <input> elements.
data-act-class
Adds a specific CSS class to the button when its theme is active.
<button data-set-theme="dark" data-act-class="ACTIVE"></button>
data-act-attribute
Sets an arbitrary HTML attribute (instead of a class) when active. This is useful for accessibility (e.g., aria-pressed).
- With value: Use
name:value syntax. The first colon is the separator. Example: aria-pressed:true sets aria-pressed="true" when active and removes it when inactive. - Boolean presence: Use just the name. Example:
aria-current adds aria-current="" when active and removes it when inactive.
<!-- Sets aria-pressed="true" when active -->
<button data-set-theme="dark" data-act-attribute="aria-pressed:true"></button>
<!-- Adds aria-current="" when active -->
<button data-set-theme="pink" data-act-attribute="aria-current"></button>
<button data-set-theme="" data-act-class="ACTIVE"></button>
<button data-set-theme="dark" data-act-class="ACTIVE"></button>
<button data-set-theme="dark" data-act-attribute="aria-pressed:true"></button>
<button data-set-theme="pink" data-act-attribute="aria-current"></button>