Overview
- Keyboard Shortcuts: Open with
CMD+K(Mac) orCtrl+K(Windows/Linux) - Search & Filter: Real-time filtering as you type
- Keyboard Navigation: Arrow keys to navigate, Enter to execute
- Customizable: Add your own commands with icons, shortcuts, and categories
- Accessible: Full keyboard and screen reader support
Basic Usage
Global Keyboard Shortcuts
For app-wide command palette access, wrap your app withHuxCommandShortcuts.wrapper:
Command Item Properties
Shortcut Format
Use Apple symbols for shortcuts without ’+’ signs:- Command:
⌘ - Shift:
⇧ - Option:
⌥ - Control:
⌃
⌘K- Command + K⌘⇧F- Command + Shift + F⌘⌥T- Command + Option + T
Customization
Custom Placeholder
Custom Empty State
Command Categories
Organize commands by category for better user experience:Keyboard Navigation
CMD+K/Ctrl+K: Open command palette↑/↓: Navigate through commandsEnter: Execute selected commandEscape: Close command palette- Type: Filter commands by name
Examples
File Management Commands
Navigation Commands
Best Practices
Command Organization: Group related commands by category and use consistent naming conventions.
Shortcut Conflicts: Ensure keyboard shortcuts don’t conflict with system shortcuts or other app shortcuts.
Accessibility: Always provide meaningful labels and descriptions for screen readers.
API Reference
HuxCommand
The main command palette widget.Constructor
HuxCommandItem
Represents a single command in the palette.Constructor
HuxCommandShortcuts
Utility class for global keyboard shortcuts.Methods
wrapper()- Wraps your app to provide global shortcutshandleKeyEvent()- Returns a key event handler for custom integration