Constructor options
The HotKeyPad constructor accepts an optional configuration object with the following properties:closeKey
The keyboard key used to close the command palette.
placeholder
Placeholder text displayed in the search input field.
emptyMessage
Message displayed when the search returns no results.
activationLetter
The letter key combined with Cmd (macOS) or Ctrl (Windows/Linux) to open the palette. For example,
"K" creates Cmd+K or Ctrl+K.Full example
HTML data attributes
You can also configure HotKeyPad using HTML data attributes on the root element. These attributes take precedence over constructor options.Required element
HotKeyPad requires an element with the idhotkeypad to exist in the DOM:
data-placeholder
Sets the placeholder text for the search input. Overrides the
placeholder constructor option.data-activation-letter
Sets the activation letter key. Overrides the
activationLetter constructor option. Value is automatically converted to uppercase.data-close-key
Sets the key used to close the palette. Overrides the
closeKey constructor option. Value is automatically converted to uppercase.Example with data attributes
Dark mode support
HotKeyPad automatically detects dark mode by observing thedark class on the root element:
dark class is present, icon colors are automatically adjusted from black to white.
Custom footer
You can provide a custom footer by including a template element with the idhotkeypad-footer: