How do I remove the default cmd + k?
This post might have stale content, as dev is 23 commits ahead.
how do i remove the default cmd + k?
I'll help you find out how to remove or disable the default Cmd + K keyboard shortcut in Fumadocs. Let me search for relevant code related to this shortcut.
I found the answer. The Cmd + K (or Ctrl + K on Windows) shortcut is the default hotkey for opening the search dialog in Fumadocs. Looking at the SearchProvider component, you can see it accepts a hotKey prop that defaults to Meta/Ctrl + K.
##How to Remove or Disable the Default Cmd + K Shortcut
You have a few options:
###Option 1: Pass an empty array to disable all hotkeys
import { SearchProvider } from 'fumadocs-ui/provider';
<SearchProvider
SearchDialog={YourSearchDialog}
hotKey={[]} // Disables all keyboard shortcuts
>
{children}
</SearchProvider>
###Option 2: Replace with a custom hotkey
<SearchProvider
SearchDialog={YourSearchDialog}
hotKey={[
{
key: '/', // Use "/" key instead
display: '/',
},
]}
>
{children}
</SearchProvider>
###Option 3: Use a different key combination
<SearchProvider
SearchDialog={YourSearchDialog}
hotKey={[
{
key: (e) => e.metaKey || e.ctrlKey,
display: '⌘',
},
{
key: 'j', // Use Cmd/Ctrl + J instead
display: 'J',
},
]}
>
{children}
</SearchProvider>
The hotKey prop accepts an array of HotKey objects where:
key: Either a string (matchinge.key) or a function that returnstruewhen the key condition is metdisplay: What to show in the UI for this key
All keys in the array must be pressed together for the shortcut to trigger.
END OF POST
Log in to add a comment
Claude Opus 4.5