Template:Key press/doc
This is the {{keypress}} template.
It can be used to illustrate keystrokes.
Example:
{{keypress|A}}
produces A
If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:
{{keypress|[[Alt key|Alt]]}}
produces Alt
To illustrate multiple keystrokes, just use extra parameters (max 4):
Some key names have a fitting unicode character. This template automatically adds such "icons" to the following key names:
{{keypress|Shift}}
produces ⇧ Shift{{keypress|Enter}}
produces ↵ Enter{{keypress|Cmd}}
produces ⌘ Cmd{{keypress|Opt}}
produces ⌥ Opt{{keypress|Tab}}
produces Tab ⇆{{keypress|Backspace}}
produces ← Backspace
Technical details
When you feed several key names to this template, it adds a "+" with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table then that might cause too wide items. Then instead manually build the key combination with spaces around the "+" so it can line wrap. Like this:
{{keypress|Ctrl}} + {{keypress|Alt}} + {{keypress|Del}}
produces Ctrl + Alt + Del
This template calls {{keypress/core}}, which holds the code that otherwise would be repeated several times in {{keypress}}, thus simplifying the code in {{keypress}}.
See also
- {{pskeypress}} – For PlayStation-style controllers.