Skip to content

hide

hide is a DOM event that occurs whenever the dropdown hides.

Event body

The hide body has a TDropdownHideEventDetails type which represents the details of the hidden dropdown. It is optional so it might not exist.

Example

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

useStorefront(async (storefront) => {
    document.addEventListener('hide', (event) => {
        const detail = event.detail;

        if (!detail) return;

        const { name } = detail;

        console.log('dropdown of name ', name, ' has been hidden');
    });
});