Command palette
npm install luna-command-paletteCommand palette.
https://luna.liriliri.io/?path=/story/command-palette
Add the following script and style to your page.
``html`
You can also get it on npm.
`bash`
npm install luna-command-palette --save
`javascript`
import 'luna-command-palette/luna-command-palette.css'
import LunaCommandPalette from 'luna-command-palette'
`javascript``
const container = document.getElementById('container')
const commandPalette = new LunaCommandPalette(container, {
placeholder: 'Type a command',
shortcut: 'Ctrl+P',
commands: [
{
title: 'Reload Page',
shortcut: 'Ctrl+R',
handler(e) {
if (e && e.preventDefault) {
e.preventDefault()
}
location.reload()
}
}
]
})
commandPalette.show()
* commands(ICommand[]): Commands to show.
* placeholder(string): Search input placeholder.
* shortcut(string): Keyboard shortcut for opening the command palette.
Hide command palette.
Show command palette.
* title(string): Command title.