Template:Key press/doc: Difference between revisions
>SMcCandlish +1 |
m →Wikilinks: Corrected Alt key |
||
(4 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This is the {{ | This is the <code><nowiki>{{key press}}</nowiki></code> template primarily designed to illustrate keys and keystrokes on a [https://en.wikipedia.org/wiki/Keyboard_technology computer keyboard]. With additional parameters, a single template can even illustrate a combination of multiple ''simultaneous'' keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates. | ||
Example | Example | ||
: {{ | : <code><nowiki>{{key press|A}}</nowiki></code> → {{key press|A}} | ||
===Keystroke combinations=== | ===Keystroke combinations=== | ||
To illustrate keystroke combinations, just use extra parameters: | To illustrate keystroke combinations, just use extra parameters: | ||
: {{ | : <code><nowiki>{{key press|Alt|P}}</nowiki></code> → {{key press|Alt|P}} | ||
: {{ | : <code><nowiki>{{key press|Ctrl|Alt|Del}}</nowiki></code> → {{key press|Ctrl|Alt|Del}} | ||
When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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: | When you feed several key names to this template, it adds a "+" (or whatever the contents of the optional ''chain'' parameter) 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: | ||
: {{ | : <code><nowiki>{{key press|Ctrl}}</nowiki></code> + <code><nowiki>{{key press|Alt}}</nowiki></code> + <code><nowiki>{{key press|Del}}</nowiki></code> → {{key press|Ctrl}} + {{key press|Alt}} + {{key press|Del}} | ||
: {{ | : <code><nowiki>{{key press|Ctrl|Alt|Del|5=chain=&#32;+&#32;}}</nowiki></code> → {{key press|Ctrl|Alt|Del|chain= + }} | ||
On the other hand, to illustrate Windows [ | On the other hand, to illustrate Windows [https://en.wikipedia.org/wiki/Alt_code Alt code]s you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the [https://en.wikipedia.org/wiki/Plus%E2%80%93minus_sign plus-minus sign] (±) can be entered by holding down the Alt key while typing <code>0177</code> (with the [https://en.wikipedia.org/wiki/Numeric_keypad numeric keypad]): | ||
: {{ | : <code><nowiki>{{key press|Alt|0}}{{key press|1}}{{key press|7}}{{key press|7}}</nowiki></code> → {{key press|Alt|0}}{{key press|1}}{{key press|7}}{{key press|7}} | ||
An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application: | An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application: | ||
: {{ | : <code><nowiki>{{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}}</nowiki></code> → {{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}} | ||
===Wikilinks=== | ===Wikilinks=== | ||
If there is an article about the key you can [ | If there is an article about the key you can [https://en.wikipedia.org/wiki/Wikipedia:Wikilink wikilink] the key's name like any other wiki text. Like this: | ||
* {{ | * <code><nowiki>{{key press|[[https://en.wikipedia.org/wiki/Alt_key|Alt]]}}</nowiki></code> → {{key press|Alt}} | ||
If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>[[Control key|Ctrl]]</nowiki></code> instead of <code><nowiki>[[Ctrl]]</nowiki></code>, which leads to a [ | If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. <code><nowiki>[[Control key|Ctrl]]</nowiki></code> instead of <code><nowiki>[[Ctrl]]</nowiki></code>, which leads to a [https://en.wikipedia.org/wiki/Wikipedia:Disambiguation_page disambiguation page]). | ||
===Wiki markup characters=== | ===Wiki markup characters=== | ||
Some wiki markup characters, like the [ | Some wiki markup characters, like the [https://en.wikipedia.org/wiki/Pipe_symbol pipe symbol], the [https://en.wikipedia.org/wiki/Semicolon semicolon] and the [https://en.wikipedia.org/wiki/Equals_sign equals sign], need to be entered using the <code><nowiki>{{!}}</nowiki></code>, <code><nowiki>{{;}}</nowiki></code> and <code><nowiki>{{=}}</nowiki></code> templates or as an [https://en.wikipedia.org/wiki/HTML_entity HTML entity] &#124;, &#59;, &#61; respectively: | ||
* {{ | * <code><nowiki>{{key press|{{pipe}}}}</nowiki></code> → {{key press|{{pipe}}}} | ||
* {{ | * <code><nowiki>{{key press|&#124;}}</nowiki></code> → {{key press||}} | ||
* {{ | * <code><nowiki>{{key press|{{;}}}}</nowiki></code> → {{key press|{{;}}}} | ||
* {{ | * <code><nowiki>{{key press|&#59;}}</nowiki></code> → {{key press|;}} | ||
* {{ | * <code><nowiki>{{key press|{{=}}}}</nowiki></code> → {{key press|{{=}}}} | ||
* {{ | * <code><nowiki>{{key press|&#61;}}</nowiki></code> → {{key press|=}} | ||
However, if the characters are marked as wikilinks, they can be entered as such: | However, if the characters are marked as wikilinks, they can be entered as such: | ||
* {{ | * <code><nowiki>{{key press|[[|]]}}</nowiki></code> → {{key press|}} | ||
* {{ | * <code><nowiki>{{key press|[[;]]}}</nowiki></code> → {{key press|[[;]]}} | ||
* {{ | * <code><nowiki>{{key press|[[=]]}}</nowiki></code> → {{key press|[[=]]}} | ||
Most markup characters also have aliases: | Most markup characters also have aliases: | ||
* {{ | * <code><nowiki>{{key press|pipe}}</nowiki></code> → {{key press|pipe}} | ||
* {{ | * <code><nowiki>{{key press|semicolon}}</nowiki></code> → {{key press|semicolon}} | ||
* {{ | * <code><nowiki>{{key press|equals}}</nowiki></code> → {{key press|equals}} | ||
* {{ | * <code><nowiki>{{key press|colon}}</nowiki></code> → {{key press|colon}} | ||
* {{ | * <code><nowiki>{{key press|asterisk}}</nowiki></code> → {{key press|asterisk}} | ||
* {{ | * <code><nowiki>{{key press|hash}}</nowiki></code> → {{key press|hash}} | ||
===Key symbols=== | ===Key symbols=== | ||
Some key names have a fitting [ | Some key names have a fitting [https://en.wikipedia.org/wiki/Unicode Unicode] character. This template automatically adds such "icons" to the following key names among others. | ||
* {{ | * <code><nowiki>{{key press|Shift}}</nowiki></code> → {{key press|Shift}} | ||
* {{ | * <code><nowiki>{{key press|Tab}}</nowiki></code> → {{key press|Tab}} | ||
* {{ | * <code><nowiki>{{key press|Enter}}</nowiki></code> → {{key press|Enter}} | ||
* {{ | * <code><nowiki>{{key press|Option}}</nowiki></code> → {{key press|Option}} | ||
* {{ | * <code><nowiki>{{key press|Opt}}</nowiki></code> → {{key press|Opt}} | ||
* {{ | * <code><nowiki>{{key press|Command}}</nowiki></code> → {{key press|Command}} | ||
* {{ | * <code><nowiki>{{key press|Cmd}}</nowiki></code> → {{key press|Cmd}} | ||
* {{ | * <code><nowiki>{{key press|Caps Lock}}</nowiki></code> → {{key press|Caps Lock}} | ||
* {{ | * <code><nowiki>{{key press|Scroll Lock}}</nowiki></code> → {{key press|Scroll Lock}} | ||
* {{ | * <code><nowiki>{{key press|Up}}</nowiki></code> → {{key press|Up}} | ||
* {{ | * <code><nowiki>{{key press|Down}}</nowiki></code> → {{key press|Down}} | ||
* {{ | * <code><nowiki>{{key press|Left}}</nowiki></code> → {{key press|Left}} | ||
* {{ | * <code><nowiki>{{key press|Right}}</nowiki></code> → {{key press|Right}} | ||
There are no characters for the [https://en.wikipedia.org/wiki/Windows_key|Windows key] and [https://en.wikipedia.org/wiki/Menu_key|Menu key]. So this template shows approximate characters for them, namely the {{sc2|SQUARED PLUS}} and {{sc2|STRICTLY EQUIVALENT TO}} from the [https://en.wikipedia.org/wiki/Mathematical_Operators|Mathematical Operators] Unicode block: | |||
* <code><nowiki>{{key press|Win}}</nowiki></code> → {{key press|Win}} | |||
There are no characters for the [ | * <code><nowiki>{{key press|Menu}}</nowiki></code> → {{key press|Menu}} | ||
* {{ | |||
* {{ | |||
====Video games==== | ====Video games==== | ||
Line 79: | Line 73: | ||
=====Directional input===== | =====Directional input===== | ||
The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices. | The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices. | ||
* {{ | * <code><nowiki>{{key press|l-down}}</nowiki></code> → {{key press|l-down}} | ||
* {{ | * <code><nowiki>{{key press|c-left}}</nowiki></code> → {{key press|c-left}} | ||
* {{ | * <code><nowiki>{{key press|r-up}}</nowiki></code> → {{key press|r-up}} | ||
Stick specific diagonals are also supported: | Stick specific diagonals are also supported: | ||
* {{ | * <code><nowiki>{{key press|l-nw}}</nowiki></code> → {{key press|l-nw}} | ||
* {{ | * <code><nowiki>{{key press|c-se}}</nowiki></code> → {{key press|c-se}} | ||
* {{ | * <code><nowiki>{{key press|r-ne}}</nowiki></code> → {{key press|r-ne}} | ||
=====PlayStation===== | =====PlayStation===== | ||
* {{ | * <code><nowiki>{{key press|ex}}</nowiki></code> → {{key press|ex}} | ||
* {{ | * <code><nowiki>{{key press|circle}}</nowiki></code> → {{key press|circle}} | ||
* {{ | * <code><nowiki>{{key press|triangle}}</nowiki></code> → {{key press|triangle}} | ||
* {{ | * <code><nowiki>{{key press|square}}</nowiki></code> → {{key press|square}} | ||
{{clear}} | {{clear}} | ||
===TemplateData=== | ===TemplateData=== | ||
This is the TemplateData docuementation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template. | |||
====TemplateData for Key press==== | |||
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. | |||
" | {| class="wikitable" | ||
" | !scope="col" colspan="2"|Parameter | ||
" | !scope="col"|Description | ||
" | !scope="col"|Type | ||
!scope="col"|Status | |||
|- | |||
!scope="col"|First key. | |||
" | |<code>1</code> | ||
|First key | |||
|Line | |||
|'''required''' | |||
" | |- | ||
!scope="col"|Second key | |||
|<code>2</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Third key | ||
|<code>3</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Fourth key | |||
|<code>4</code> | |||
" | |Optional key press in combination as the first. | ||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Fifth key | ||
|<code>5</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Sixth key | |||
|<code>6</code> | |||
" | |Optional key press in combination as the first. | ||
|Line | |||
|optional | |||
|- | |||
" | !scope="col"|Seventh key | ||
|<code>7</code> | |||
|Optional key press in combination as the first. | |||
|Line | |||
" | |optional | ||
|- | |||
!scope="col"|Eighth key | |||
|<code>8</code> | |||
|Optional key press in combination as the first. | |||
" | |Line | ||
|optional | |||
|- | |||
!scope="col"|Ninth key | |||
" | |<code>9</code> | ||
|Optional key press in combination as the first. | |||
|Line | |||
|optional | |||
" | |- | ||
!scope="col"|Tenth key | |||
|<code>10</code> | |||
|Optional key press in combination as the first. | |||
" | |Line | ||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>chain</code> | |||
} | |Character between chained key presses.<br>'''Default'''<br>+ | ||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between first and second key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between second and third key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between third and fourth key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|- | |||
!scope="col"|Chaining character | |||
|<code>10</code> | |||
|Character between fourth and fifth key press.<br>'''Default'''<br>+ | |||
|Line | |||
|optional | |||
|} | |||
===See also=== | ===See also=== | ||
* {{ | * <code><nowiki>{{Key top}}</nowiki></code> – produces a similar visual effect, but includes more symbols and does not directly support key combinations (e.g. <code><nowiki>{{key top|Caps Lock}}</nowiki></code>). | ||
* {{ | * <code><nowiki>{{Button}}</nowiki></code> – produces a similar visual effect but without the semantic markup (e.g. {{Button|sample text}}); more for representing interface elements. | ||
* {{ | * <code><nowiki>{{Playstation key press}}</nowiki></code> – to simulate gamepad buttons (e.g. <code><nowiki>{{Playstation key press|s}}</nowiki></code>). | ||
* {{ | * <code><nowiki>{{Kbd}}</nowiki></code> – to indicate user input (of any kind) without making it look like keys or buttons. | ||
Latest revision as of 09:27, 29 May 2021
This is the {{key press}}
template primarily designed to illustrate keys and keystrokes on a computer keyboard. With additional parameters, a single template can even illustrate a combination of multiple simultaneous keystrokes. A sequence of keystrokes, on the other hand, need to be demonstrated with separate templates.
Example
{{key press|A}}
→ A
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 optional chain parameter) 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:
{{key press|Ctrl}}
+{{key press|Alt}}
+{{key press|Del}}
→ Ctrl + Alt + Del{{key press|Ctrl|Alt|Del|5=chain= + }}
→ Ctrl + Alt + Del
On the other hand, to illustrate Windows Alt codes you might want to use separate templates with no intervening punctuation or space. In most Windows systems in North America and Western Europe, for example, the plus-minus sign (±) can be entered by holding down the Alt key while typing 0177
(with the numeric keypad):
{{key press|Alt|0}}{{key press|1}}{{key press|7}}{{key press|7}}
→ Alt+0177
An example of a use case where more than 5 might be used is explaining usage of a macro (keyboard shortcut) created by a third-party application:
{{Key press|Ctrl|Alt|Shift|Win|Menu|fn|L}}
→ Ctrl+Alt+⇧ Shift+⊞ Win+≣ Menu+fn+L
Wikilinks
If there is an article about the key you can wikilink the key's name like any other wiki text. Like this:
{{key press|[[https://en.wikipedia.org/wiki/Alt_key|Alt]]}}
→ Alt
If you are wikilinking the keys, please ensure that you are piping to the correct page (e.g. [[Control key|Ctrl]]
instead of [[Ctrl]]
, which leads to a disambiguation page).
Wiki markup characters
Some wiki markup characters, like the pipe symbol, the semicolon and the equals sign, need to be entered using the {{!}}
, {{;}}
and {{=}}
templates or as an HTML entity |, ;, = respectively:
{{key press|{{pipe}}}}
→ |{{key press||}}
→ |{{key press|{{;}}}}
→ ;{{key press|;}}
→ ;{{key press|{{=}}}}
→ ={{key press|=}}
→ =
However, if the characters are marked as wikilinks, they can be entered as such:
Most markup characters also have aliases:
{{key press|pipe}}
→ |{{key press|semicolon}}
→ ;{{key press|equals}}
→ ={{key press|colon}}
→ :{{key press|asterisk}}
→ *{{key press|hash}}
→ #
Key symbols
Some key names have a fitting Unicode character. This template automatically adds such "icons" to the following key names among others.
{{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|Scroll Lock}}
→ Scroll Lock{{key press|Up}}
→ ↑{{key press|Down}}
→ ↓{{key press|Left}}
→ ←{{key press|Right}}
→ →
There are no characters for the key and key. So this template shows approximate characters for them, namely the SQUARED PLUS and STRICTLY EQUIVALENT TO from the Operators Unicode block:
{{key press|Win}}
→ ⊞ Win{{key press|Menu}}
→ ≣ Menu
Video games
Video game controllers often have specialized input labels that do not map easily. The following are mappings for various game consoles and input features.
Directional input
The following should only be used when the input sequence uses something other than the primary input or mixes input between directional devices.
{{key press|l-down}}
→ L↓{{key press|c-left}}
→ C←{{key press|r-up}}
→ R↑
Stick specific diagonals are also supported:
{{key press|l-nw}}
→ L↖{{key press|c-se}}
→ C↘{{key press|r-ne}}
→ R↗
PlayStation
{{key press|ex}}
→ ×{{key press|circle}}
→ ○{{key press|triangle}}
→ △{{key press|square}}
→ □
TemplateData
This is the TemplateData docuementation for this template used by VisualEditor and other tools; see the monthly parameter usage report for this template.
TemplateData for Key press
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.
Parameter | Description | Type | Status | |
---|---|---|---|---|
First key. | 1
|
First key | Line | required |
Second key | 2
|
Optional key press in combination as the first. | Line | optional |
Third key | 3
|
Optional key press in combination as the first. | Line | optional |
Fourth key | 4
|
Optional key press in combination as the first. | Line | optional |
Fifth key | 5
|
Optional key press in combination as the first. | Line | optional |
Sixth key | 6
|
Optional key press in combination as the first. | Line | optional |
Seventh key | 7
|
Optional key press in combination as the first. | Line | optional |
Eighth key | 8
|
Optional key press in combination as the first. | Line | optional |
Ninth key | 9
|
Optional key press in combination as the first. | Line | optional |
Tenth key | 10
|
Optional key press in combination as the first. | Line | optional |
Chaining character | chain
|
Character between chained key presses. Default + |
Line | optional |
Chaining character | 10
|
Character between first and second key press. Default + |
Line | optional |
Chaining character | 10
|
Character between second and third key press. Default + |
Line | optional |
Chaining character | 10
|
Character between third and fourth key press. Default + |
Line | optional |
Chaining character | 10
|
Character between fourth and fifth key press. Default + |
Line | optional |
See also
{{Key top}}
– produces a similar visual effect, but includes more symbols and does not directly support key combinations (e.g.{{key top|Caps Lock}}
).{{Button}}
– produces a similar visual effect but without the semantic markup (e.g. sample text); more for representing interface elements.{{Playstation key press}}
– to simulate gamepad buttons (e.g.{{Playstation key press|s}}
).{{Kbd}}
– to indicate user input (of any kind) without making it look like keys or buttons.