This template is used inMediaWiki:Clearyourcache, and onapproximately 4,200 pages. Changes to it can cause immediate changes to the Wikipedia user interface. To avoid major disruption, any changes should be tested in the template's/sandbox or/testcases subpages, or in your ownuser subpage. The tested changes can be added to this page in a single edit. Please discuss changes on thetalk page before implementing them.
This is the{{key press}} template primarily designed to illustrate keys and keystrokes on acomputer keyboard. With additional parameters, a single template can even illustrate a combination of multiplesimultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.
Example
{{key press|A}} →A
As lower-case alphabetic characters a–z do not appear on most keyboards, they shouldgenerally not be used as parameters.
Keystroke combinations
To illustrate keystroke combinations, just use extra parameters:
{{key press|Alt|P}} →Alt+P
{{key press|Ctrl|Alt|Del}} →Ctrl+Alt+Del
When you feed several key names to this template, it adds a "+" (or whatever the contents of the optionalchain parameter) with no spaces around. This means it won't line wrap. But when you show key combinations for instance in a table that might cause items to be too wide. Instead manually build the key combination with spaces around the "+" so it can line wrap:
{{key press|Ctrl|Alt|Del|chain= + }} →Ctrl + Alt + Del
To illustrate sequences where all keys do not need to be pressed simultaneously, the plus signs can be omitted by settingchain=. For example, in most Windows systems in North America and Western Europe,Alt codes can be used to insert theplus-minus sign (±) by holding down theAlt key while typing0177 with thenumeric keypad:
If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g.[[Alt key|Alt]] instead of[[Alt]], which leads to adisambiguation page).
Wiki markup characters
Some wiki markup characters, like thepipe symbol “|”, thesemicolon “;” and theequals sign “=”, need to be entered using the{{!}} ({{Pipe}}),{{;}} and{{=}} templates or as anHTML entity| (|),; (;),= (=) respectively:
{{key press|{{!}}}} →|
{{key press||}} →|
{{key press|{{;}}}} →;
{{key press|;}} →;
{{key press|{{=}}}} →=
{{key press|=}} →=
However, if the characters are marked as wikilinks, they can be entered as such:
Several keys have a correspondingUnicode character. This template automatically adds such "icons" to the following key names:
{{key press|Shift}} →⇧ Shift
{{key press|Tab}} →Tab ↹
{{key press|Enter}} →↵ Enter
{{key press|Option}} →⌥ Option
{{key press|Opt}} →⌥ Opt
{{key press|Command}} →⌘ Command
{{key press|Cmd}} →⌘ Cmd
{{key press|Caps Lock}} →⇪ Caps Lock
{{key press|Up}} →↑
{{key press|Down}} →↓
{{key press|Left}} →←
{{key press|Right}} →→
Windows key and Menu keyOld-style Windows key
There is no character for theWindows key or theMenu key, so this template uses as approximations theSQUARED PLUS andSTRICTLY EQUIVALENT TO characters from theMathematical Operators Unicode block:
{{key press|Win}} →⊞ Win
{{key press|Menu}} →≣ Menu
Symbol suppression
In some cases, the automatic recognition of tokens and consequent addition of symbols may not be desired. In these cases, token recognition can be suppressed with the use ofHTML encoding.For example:
{{key press|Enter}} →Enter
{{key press|Enter}} →↵ Enter
Video games
Video-game controllers often have specialized input labels that are not easily mapped. The following are mappings for various game consoles and input features.
Directional input
The following should be used only when the input sequence uses something other than the primary input, or mixes input between directional devices.
Illustrates keys and keystrokes on a computer keyboard. Keys can include: Ctrl, Alt, Del, Opt, Menu, Left etc. console keys: ex, circle, triangle, square, and left right and center analog sticks: l-down, c-left, r-ne. The names are case insensitive.
To indicate text is a variable name. Use for any variable names except those including "I" (uppercase i) and/or "l" (lowercase L); for these, {{var serif}} should be used to ensure a noticeable distinction
To display parameters as used in code (i.e. with triple braces), especially to indicate relationships between them. May be combined with {{para}} above
To display parameter values lightly bordered; replaces <code>...</code>, especially when value contains embedded or leading/trailing blanks; visualized here withmiddot (·) but can use ␠, ▯, or any character.
To indicate text is source code. To nest other templates within {{code}}, use<code>...</code>.{{codett}} differs only in styling:someMethod becomessomeMethod
( or{{dc}}) To indicatedeprecated source code in template documentation, articles on HTML specs, etc. The{{dc2}} variant uses strike-through (<blink>) while{{dcr}} uses red (<blink>).