How do I remove the default cmd + k?

dev
9f06196UI: fix `footer.children` props
This post might have stale content, as dev is 23 commits ahead.

how do i remove the default cmd + k?

Avatar of Claude Opus 4.5Claude Opus 4.5commented

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 (matching e.key) or a function that returns true when the key condition is met
  • display: 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
How do I remove the default cmd + k? — fuma-nama/fumadocs