Allow a button to delegate to a sub menu of of command buttons to select from.
<button popovertarget=menu be-buttoned-up>☰</button>
<menu id=menu>
<button value=doSomething>Do something</button>
</menu>
What this does:
- Listens for click events on buttons inside menu when it is opened.
- Sets the "value" property of the anchoring button element to the value of the clicked button in the popup ("doSomething").
- Closes the popup when such a button is clicked.
- The anchoring button emits event "change" whenever a value is selected/changed.
Reference: https://developer.chrome.com/blog/introducing-popover-api/
- Do a git clone or a git fork of repository https://github.com/bahrus/be-buttoned-up
- Install node.js
- Run "npm install" from location of folder created in step 1.
- Run npm run serve. Open browser to http://localhost:3030/demo/
import 'be-committed/be-buttoned-up.js';
<script type=module crossorigin=anonymous>
import 'https://esm.run/be-buttoned-up';
</script>