kbar is a React component that adds a command-and-k keyboard palette to a site so visitors can trigger actions from a searchable menu.
Overview
kbar implements a command palette pattern similar to desktop spotlight-style UIs. Authors register actions with names, shortcuts, keywords, and handlers, then wrap part or all of an application in a provider.
Shipped UI pieces include portals, animators, search fields, and virtualized result lists driven by hooks such as useMatches and KBarResults. Keyboard navigation covers movement through results and binding shortcuts to specific actions.
Nested actions allow multi-step flows, including backing out with the keyboard. The library targets performance for large action lists and includes screen reader support.
Installation is via npm. Integration typically combines a provider, an action list, and composed UI components so cmd+k or ctrl+k opens the palette in the browser.
Key features
- React command palette provider
- Customizable palette UI parts
- Keyboard navigation and shortcuts
- Nested action trees
- Virtualized search results
- Screen reader support
- High-volume action lists
Use cases
- Site-wide quick actions
- Documentation search shortcuts
- Power-user web navigation
- Keyboard-driven marketing sites