Skip to content

toggle

toggle is a DOM event that occurs whenever the toggle button is being toggled.

Event body

none

Example

In this example we listen to toggle event and perform an action whenever it's emitted.

useStorefront(async (storefront) => {
    document.addEventListener('toggle', () => {
        console.log('toggle button has been toggled');
    });
});