Skip to main content

KeysDefine

type KeysDefine = string | {
key: string;
ctrl?: boolean;
shift?: boolean;
alt?: boolean;
meta?: boolean;
};

KeysDefine is a type that defines a keyboard shortcut. It can be a string or an object.

In the string format, it should be a list of keys separated by +. For example, ctrl+shift+p is a valid shortcut.

In the object format, it should be an object with the following properties:

PropertyTypeDescription
keystringKey name. Refer to this table for a list of valid keys.
ctrlboolean | undefinedWhether to require CTRL key.
shiftboolean | undefinedWhether to require SHIFT key.
altboolean | undefinedWhether to require ALT key.
metaboolean | undefinedWhether to require the meta key. This could be the 🪟 key on Windows or the ⌘ key on Mac.