The Kbar component provides a powerful command palette for your application, allowing users to quickly navigate and perform actions using keyboard shortcuts. It enhances productivity by providing a searchable interface for commands and navigation.
To open the palette from a header button, a menu item or a sidebar link, control it with open and onOpenChange and leave out children. ⌘K still toggles it, and Escape hands focus back to your button.
Each item in the command palette is defined by the KbarItem interface:
You must provide either href or perform for each item to define what happens when the item is selected.
The Kbar component supports full keyboard navigation:
- ↑ / ↓: Navigate between items
- Enter: Select the highlighted item
- Esc: Close the command palette
Users can also type to search and filter the available commands.
- Keep item names short and descriptive
- Use icons to make items more recognizable
- Group related items into logical sections
- Include relevant keywords to improve search results
- Provide keyboard shortcuts for frequently used actions
- Consider adding a visible button to open Kbar for discoverability