Navigation
Command Palette
A spotlight-style navigation overlay opened with Cmd+K or Ctrl+K from anywhere.
<script>
import { CommandPalette } from "@codeatlasdev/ui";
import { goto } from "$app/navigation";
let open = $state(false);
</script>
<CommandPalette modules={NAV} onNavigate={(path) => goto(path)} bind:open />
The palette searches the same NavModule[] you pass to AppShellLayout. It registers Cmd+K and Ctrl+K itself, so mount it once near the root. Results are a listbox: arrow keys move the selection, Enter confirms and Escape closes.
Open the palette
Click the button or press Cmd+K / Ctrl+K while this page is focused. Picking an item shows its path instead of navigating.
Code
Keyboard
Type to filter across every module. Queries shorter than minQueryLength keep the full grouped list.
- TypeFilter by label or module name
- ↑ ↓Move through the results
- ↵Navigate to the selected item
- ESCClose the palette
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
modules | NavModule[] | – | Navigation tree to search. Same format as AppShellLayout. |
onNavigate | (path: string) => void | – | Called with the selected item's path. Use goto() in SvelteKit or location in static sites. |
open | boolean | false | Bindable. Controls visibility. Cmd+K and Ctrl+K also toggle it. |
minQueryLength | number | 1 | Trimmed characters needed before the list is filtered. Shorter queries keep the full grouped list. |