traels-it / kommandant

A command palette implementation for Rails with Hotwire and Meilisearch
MIT License
41 stars 0 forks source link

How to trigger the command palette to appear? #18

Closed tpayet closed 7 months ago

tpayet commented 7 months ago

Hi! I just came across this gem and found it wonderful!

I installed your gem on a new rails project using Tailwindcss & Meilisearch. How do you display the command palette? What are the key bindings to toggle it?

woller commented 7 months ago

I completely forgot to document that. It does not come with any default keybindings, but instead uses the built in keyboard event filter from Stimulus. I've got it setup like this in our app:

<body class="min-h-full flex bg-zinc-100"
    data-controller="command-palette keyboard-navigation ahoy"
    data-action="keydown.meta+k->command-palette#toggle keydown.ctrl+k->command-palette#toggle keydown.esc->command-palette#hide keydown.down->keyboard-navigation#down keydown.up->keyboard-navigation#up keydown.enter->keyboard-navigation#select">
  ...
</body>
woller commented 7 months ago

I updated the documentation with some more details about this.