Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Click-to-flip-attribute upscale. Toggles a boolean attribute, ARIA two-state value, custom on/off value, or CSS class on a target — the catch-all for the recurring 'change state' pattern that doesn't have a native primitive.
The data-toggle attribute upscales a <button> with click-to-flip-attribute behavior. Three modes are auto-detected from the spec, plus a class:name shorthand. aria-controls and aria-pressed / aria-expanded are wired automatically where it makes sense.
Standard boolean HTML attrs (hidden, disabled, open, checked, readonly, …). Toggles attribute presence: absent ↔ present.
<button data-toggle="hidden" data-toggle-target="#sidebar">Toggle sidebar</button><aside id="sidebar">...</aside>
aria-pressed, aria-expanded, aria-selected, aria-checked always carry the string "true" or "false". Toggle flips between them.
<button data-toggle="aria-pressed">🔇 Mute</button>
With no data-toggle-target, the button toggles the attribute on itself.
Anything else — typically data-state — cycles between two values supplied via data-toggle-on and data-toggle-off. Defaults to "true" / "false".
<button data-toggle="data-state" data-toggle-target="#tray" data-toggle-on="open" data-toggle-off="closed"> Toggle tray</button><div id="tray" data-state="closed">...</div>
Prefix the spec with class: to toggle a CSS class instead of an attribute.
<button data-toggle="class:expanded" data-toggle-target="#card">Toggle</button><article id="card">...</article>
| Attribute | Default | Notes |
|---|---|---|
data-toggle | — | Attribute name to flip, OR class:name. |
data-toggle-target | self | CSS selector for the target. Omit for self-toggling. |
data-toggle-on | "true" | "On" value for custom mode. Set to "open" to enable aria-expanded auto-wiring. |
data-toggle-off | "false" | "Off" value for custom mode. |
The button emits toggle:change after each click.
btn.addEventListener('toggle:change', (e) => { const { spec, value, present, target } = e.detail; // spec: "hidden" | "data-state" | "class:expanded" | ... // present: true if attr/class is now applied // value: the new attribute value (for non-boolean / non-class modes)});
[popover], OR when data-toggle-on="open" is set on a data-state toggle (a common disclosure pattern).Several other primitives cover overlapping shapes — pick the one closest to your use case:
| If you want to… | Use |
|---|---|
| Open a popover | Native popovertarget (no JS needed) |
| Invoke a registered command (close, open, …) on a target | Native commandfor (WICG; works with <dialog>, [popover], custom-defined commands). VB wires this via data-command. |
| Show / hide based on a form-field value | data-show-when / data-hide-when |
| Toggle a checkbox styled as a switch | data-switch on <input type="checkbox"> |
| Reveal masked content | data-spoiler |
Animate a <details> | data-accordion |
| Anything else — flip arbitrary attribute / class on a target | This attribute. |