npm.io
1.0.5 • Published 5 years ago

@fantassin/toggable-element

Licence
ISC
Version
1.0.5
Deps
0
Size
4 kB
Vulns
0
Weekly
0

Toggable Element

Create Toggable Element quickly and with A11Y in mind

How to use ?

<button class="menu__button"></button>

<section class="menu">
    <button class="menu__button--close"></button>
    <>...</>
</section>

Here is the markup. When you click on your button, it will open and add the class of your ${selector}--open.

When the markup is done, create the JS

import ToggableElement from '@fantassin/toggable-element'

const menu = new ToggableElement('.menu');

And... It's done!