keyboard-symbol
Convert key names to symbols like ⌘, ⇧, ⌥ and many more. Supports common symbols for Mac and Windows keyboards.
Install
npm install keyboard-symbol
Usage
//=> ⌘ //=> ❖ //=> ⌃ //=> ctrl //=> unknownKeyName
API
keyboardSymbol(key, OS)
key
Type: string
Default: ''
Your KeyboardEvent.key.
OS
Type: string
Default: mac
Can be mac
or win
.
List of symbols
⌃ ⌥ ⌘ ❖ ⇪ ⇧ ↑ → ↓ ← ↩ ⌫ ⌦ ⎋ ⇥ ⇞ ⇟ ␣ ctrl alt (source)