Simple menu.
https://luna.liriliri.io/?path=/story/menu
Add the following script and style to your page.
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/luna-menu/luna-menu.css" />
<script src="//cdn.jsdelivr.net/npm/luna-menu/luna-menu.js"></script>
You can also get it on npm.
npm install luna-menu --save
import 'luna-menu/luna-menu.css'
import LunaMenu from 'luna-menu'
const menu = new LunaMenu()
menu.append({
type: 'normal',
label: 'New File',
click() {
console.log('New File clicked')
}
})
menu.show(0, 0)
Append menu item.
Inert menu item to given position.
Show menu at target position.
Create menu from template.
- label(string): Menu label.
- submenu(LunaComponent): Sub menu.
- type('normal' | 'separator' | 'submenu'): Menu type.
- click(function): Click event handler.