Template:Keypress/doc: Difference between revisions
From Vintage Story Wiki
(cat fix) |
(Marked this version for translation) |
||
Line 1: | Line 1: | ||
<languages /> | <languages /> | ||
<translate> | <translate> | ||
<!--T:1--> | |||
This template allows users to use in-line "keypress" formatting, for demonstrating which keyboard key(s) a user should press. There is currently no special key for mouse clicks. | This template allows users to use in-line "keypress" formatting, for demonstrating which keyboard key(s) a user should press. There is currently no special key for mouse clicks. | ||
== Usage == | == Usage == <!--T:2--> | ||
<!--T:3--> | |||
At its most basic, the template can be used for regular keys by inserting the following: <code><nowiki>{{Keypress|W}}</nowiki></code>. The first parameter is the display text. The template takes two optional parameters, keyID and keyClass. | At its most basic, the template can be used for regular keys by inserting the following: <code><nowiki>{{Keypress|W}}</nowiki></code>. The first parameter is the display text. The template takes two optional parameters, keyID and keyClass. | ||
<pre> | <pre> | ||
Line 13: | Line 15: | ||
}}</pre> | }}</pre> | ||
=== Parameters === | === Parameters === <!--T:4--> | ||
<!--T:5--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- | ||
Line 26: | Line 29: | ||
|} | |} | ||
=== Examples === | === Examples === <!--T:6--> | ||
<!--T:7--> | |||
{| class="wikitable" | {| class="wikitable" | ||
|- | |- |
Revision as of 18:04, 31 July 2023
This template allows users to use in-line "keypress" formatting, for demonstrating which keyboard key(s) a user should press. There is currently no special key for mouse clicks.
Usage
At its most basic, the template can be used for regular keys by inserting the following: {{Keypress|W}}
. The first parameter is the display text. The template takes two optional parameters, keyID and keyClass.
{{Keypress |Display text (must be first!) |keyID= the element ID. Optional |keyClass= the element class, without the "key " prefix. Optional }}
Parameters
Parameters | Description | Type | Required |
---|---|---|---|
1 | The display text of the key. Will always display as uppercase. Must always be the first parameter! | any | yes |
keyID | the element ID of the key, applies specific formatting to the background | css | no |
keyClass | the element class of the key, applies specific formatting. Do not preface it with "key " | string | no |
Examples
Key type | Template text | Result | Notes |
---|---|---|---|
Regular key | {{keypress|e}} |
e | Background width is fixed |
Modifier (Shift, Ctrl, Alt) | {{keypress|CTRL|keyID=control}} |
CTRL | |
Spacebar | {{keypress|Space|keyID=key-spacebar}} |
Space | Width is fixed |
Function keys (F1-12, Esc) | {{Keypress|fn|keyID=fn}} {{Keypress|fn|keyClass=key-fn}} |
fn fn |
The keyClass method is flatter and wider than the top one. |