search palette
one search over an app's pages and commands. a field-shaped button opens the command dialog; selecting a result closes it and hands the value to the app.
bunx --bun shadcn@latest add @mk/search-paletteserves constellation, trisys, and artifacts.
example
open either trigger, type a ship's name and choose with the arrow keys and enter. escape closes the dialog. the selected sample page appears below its trigger.
selected: none yet
selected: none yet
open
the open surface, kept in the page so it takes no focus on arrival. filter the pages here too. the unavailable archive stays disabled.
selected: none yet
selected: none yet
draws where a floating layer meets the page, under its soft lift
states
the trigger is a control, so keyboard focus draws a ring outside it. a search with no match replaces the results with a quiet sentence.
rest
input edge, button behavior
focus
2 px control ring
disabled
no action
rest
input edge, button behavior
focus
2 px control ring
disabled
no action
selected: none yet
selected: none yet
shortcuts
cmd k or ctrl k toggles search, including from a text field. slash opens it away from editable text. this page gives those keys to the light example so two specimens do not compete.
SearchPalette- owns open state, or takes
openandonOpenChangefrom the app. sethotkeyto another letter ornullto disable both shortcuts. SearchPaletteTrigger- names the search. it prints no keycap.
SearchPaletteContent- supplies the named input and live results. pass its
selectcallback to eachCommandItemto close and handle the choice.