
Hotkey
- 1.8k installs
- 81.3k repo stars
- Updated August 5, 2026
- lobehub/lobehub
How to add and manage keyboard shortcuts in LobeHub with proper scoping, i18n, and conflict detection.
About
This skill guides developers through adding keyboard shortcuts to LobeHub, a chat UI framework. Developers use it to register hotkeys via HotkeyEnum constants, configure default key bindings with combineKeys and scope management, add i18n translations, and wire hooks using useHotkeyById. The workflow spans type definitions, registration config, localization, React hooks, and optional tooltip integration. Key patterns include platform-agnostic Mod key usage (Cmd/Ctrl), scope-based activation (global or chat-specific), conflict detection, and grouping hotkeys by functional area (System, Layout, Conversation).
- Define hotkey constants in HotkeyEnum and register bindings in HOTKEYS_REGISTRATION with scopes
- Use combineKeys utility and Key.Mod for cross-platform Ctrl/Cmd key combos
- Create custom hooks (useHotkeyById) that bind hotkeys to store actions and register in scope handlers
- Add i18n translations per hotkey with title and description for settings UI
- Optional Tooltip component displays hotkey binding in UI with conflict warnings
Hotkey by the numbers
- 1,797 all-time installs (skills.sh)
- +83 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #267 of 2,245 Frontend Development skills by installs in the Skillselion catalog
- Security screen: MEDIUM risk (skills.sh audit)
- Data as of Aug 5, 2026 (Skillselion catalog sync)
hotkey capabilities & compatibility
- Capabilities
- hotkey registration · scope management · conflict detection · i18n translation · tooltip integration · platform agnostic keybinding
- Use cases
- ui design · frontend
- Platforms
- macOS · Windows · Linux
- Runs
- Runs locally
What hotkey says it does
Choose global or chat scope based on functionality
HotkeyInput component shows warnings
npx skills add https://github.com/lobehub/lobehub --skill hotkeyAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1.8k |
|---|---|
| repo stars | ★ 81.3k |
| Security audit | 3 / 3 scanners passed |
| Last updated | August 5, 2026 |
| Repository | lobehub/lobehub ↗ |
What it does
Define and register keyboard shortcuts in LobeHub chat application with conflict detection and multi-scope support.
Who is it for?
React developers building chat or conversation UIs who need keyboard shortcut management with multi-scope support and i18n.
Skip if: Backend services, mobile apps without keyboard input, or applications not using LobeHub UI framework.
When should I use this skill?
Adding new keyboard shortcuts to LobeHub, fixing hotkey registration, managing scope conflicts, or localizing existing shortcuts.
What you get
A fully registered hotkey with translated labels, hook integration, optional UI tooltips, and no conflicts with system shortcuts.
- HotkeyEnum constant
- HOTKEYS_REGISTRATION entry
- i18n translation object
By the numbers
- 5-step process: enum definition, registration, i18n, hook creation, tooltip integration
- Multiple hotkey groups supported: System, Layout, Conversation
Files
Adding Keyboard Shortcuts Guide
Steps to Add a New Hotkey
1. Update Hotkey Constant
In src/types/hotkey.ts:
export const HotkeyEnum = {
// existing...
ClearChat: 'clearChat', // Add new
} as const;2. Register Default Hotkey
In src/const/hotkeys.ts:
import { KeyMapEnum as Key, combineKeys } from '@lobehub/ui';
export const HOTKEYS_REGISTRATION: HotkeyRegistration = [
{
group: HotkeyGroupEnum.Conversation,
id: HotkeyEnum.ClearChat,
keys: combineKeys([Key.Mod, Key.Shift, Key.Backspace]),
scopes: [HotkeyScopeEnum.Chat],
},
];3. Add i18n Translation
In src/locales/default/hotkey.ts:
const hotkey: HotkeyI18nTranslations = {
clearChat: {
desc: '清空当前会话的所有消息记录',
title: '清空聊天记录',
},
};4. Create and Register Hook
In src/hooks/useHotkeys/chatScope.ts:
export const useClearChatHotkey = () => {
const clearMessages = useChatStore((s) => s.clearMessages);
return useHotkeyById(HotkeyEnum.ClearChat, clearMessages);
};
export const useRegisterChatHotkeys = () => {
useClearChatHotkey();
// ...other hotkeys
};5. Add Tooltip (Optional)
const clearChatHotkey = useUserStore(settingsSelectors.getHotkeyById(HotkeyEnum.ClearChat));
<Tooltip hotkey={clearChatHotkey} title={t('clearChat.title', { ns: 'hotkey' })}>
<Button icon={<DeleteOutlined />} onClick={clearMessages} />
</Tooltip>;Best Practices
1. Scope: Choose global or chat scope based on functionality 2. Grouping: Place in appropriate group (System/Layout/Conversation) 3. Conflict check: Ensure no conflict with system/browser shortcuts 4. Platform: Use Key.Mod instead of hardcoded Ctrl or Cmd 5. Clear description: Provide title and description for users
Troubleshooting
- Not working: Check scope and RegisterHotkeys hook
- Not in settings: Verify HOTKEYS_REGISTRATION config
- Conflict: HotkeyInput component shows warnings
- Page-specific: Ensure correct scope activation
Related skills
Forks & variants (1)
Hotkey has 1 known copy in the catalog totaling 1.5k installs. They canonicalize to this original listing.
- lobehub - 1.5k installs
How it compares
Pick hotkey over generic React hotkey libraries guidance when the target codebase is specifically LobeHub and must follow its HotkeyEnum registration contract.
FAQ
What is Key.Mod and why use it instead of Ctrl or Cmd?
Key.Mod is a platform-agnostic constant that maps to Ctrl on Windows/Linux and Cmd on macOS, ensuring hotkeys work across all platforms.
What are hotkey scopes and how do I choose between them?
Scopes (Chat, Global) define where a hotkey is active. Use Chat scope for conversation-specific actions (clear chat) and Global for app-wide actions.
How do I check for keyboard shortcut conflicts?
The HotkeyInput component displays warnings, and you should manually verify your bindings don't conflict with browser or OS shortcuts (e.g., Cmd+Q).
Is Hotkey safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.