A searchable command palette.
A port of the Pines command — the ⌘K dialog for jumping around an application.
<.command id="palette" shortcut="k">
<:group label="Navigation">
<:item navigate={~p"/dashboard"} keywords="home overview">Dashboard</:item>
<:item navigate={~p"/settings"}>Settings</:item>
</:group>
<:group label="Actions">
<:item on_click="new-project" shortcut="N">New project</:item>
</:group>
</.command>Open it with ⌘K / Ctrl-K, or from anywhere:
<.button phx-click={JS.dispatch("pine:open", to: "#palette")}>Search</.button>Filtering happens on the client
Items are rendered up front and filtered by Alpine as you type. That keeps the palette
instant and works offline, but means it is only suitable for a bounded set — up to a few
hundred entries. For searching a database, drive the list from the server with
phx-change instead and leave filter={false}.