Label
Way to add a label to a form control from Template:Calculator. Adding labels using this template helps ensure calculators are accessible
Parameter | Description | Type | Status | |
---|---|---|---|---|
1 | 1 label | Text for label | Content | required |
for | for | The id from the calculator template this label is for | String | required |
class | class | CSS class or classes to add to label | String | optional |
class-live | class-live | CSS classes applied only when the gadget is enabled | String | optional |
codex | codex | Make this a codex style label | Boolean | optional |
codex-class | codex-class | Extra class on the codex wrapper
| String | optional |
description | description | [codex mode only] Additional description text about the widget that is not part of the label | Content | optional |
description-id | description-id | [codex mode only] id for the description element | String | optional |
flag | flag | [Codex mode only] Additional information about the widget. Usually to mark a field as optional
| Content | optional |
style | style | CSS for label | String | optional |
title | title | Tooltip to show on hover | String | optional |
Checkbox
Add a checkbox button for calculator gadget in codex style
Parameter | Description | Type | Status | |
---|---|---|---|---|
codex-div-class | codex-div-class | additional css classes for outer wrapper | String | optional |
id | id | id value of calculator widget. Can be referenced by other calculator templates | Unknown | required |
style | style | CSS to style the checkbox button widget | String | optional |
formula | formula | Formula to control if button is on or off. | Unknown | optional |
readonly | readonly | Make button read only. Read only buttons can be adjusted by formula but not by user interaction | Boolean | optional |
class-live | class-live | extra css classes to add only if gadget is enabled | Unknown | optional |
class | class | extra css class | String | optional |
default | default | Whether to start in a checked or unchecked state
| String | optional |
description | description | Additional description to add after the label | Content | optional |
label | label | Label for checkbox button | Unknown | required |
inline | inline | Make checkbox buttons be inline (Multiple on one line) instead of being a separate line for each | Boolean | optional |
custominput | custominput | Add another calculator widget as part of the label for a checkbox button
| Content | optional |
Interface
Add a calculator widget to the page. Like a spreadsheet you can refer to other widgets in the same page.
Parameter | Description | Type | Status | |
---|---|---|---|---|
id | id | The id for this input. This is used to reference it in formula of other calculator templates | String | required |
type | type | What type of input box
| String | required |
formula | formula | Formula to calculate this field
| String | suggested |
class | class | CSS classes to add | String | optional |
class-live | class-live | CSS class to add only if gadget is active on the page | String | optional |
decimals | decimals | Format to a fixed number of decimal digits [Only applies to type=number or type=plain]
| Number | optional |
default | default | Default value for this field | String | suggested |
exponential-precision | exponential-precision | Format to this many significant digits, using scientific notation [Only applies to type=number or type=plain]
| Number | optional |
max | max | max number allowed (type=number inputs only) | Number | optional |
min | min | min number allowed (type=number inputs only) | Number | optional |
name | name | For type=radio what group to assign the radio button to | Unknown | optional |
NaN-text | NaN-text | Use this text instead of NaN to signify "not a number". Only applies to format=plain or format=text. Plaintext only; wikitext is not supported
| String | optional |
placeholder | placeholder | Text to put as a placeholder in empty input | String | optional |
precision | precision | Format to this many significant digits, using decimal notation except for really large numbers [Only applies to type=number or type=plain]
| Number | optional |
readonly | readonly | Make input box readonly to user input | Boolean | optional |
size | size | Size of input box (How many characters it will fit) | Number | optional |
step | step | How much to increment a type=number input box
| Number | optional |
style | style | CSS to style the input element with | String | optional |
aria-describedby | aria-describedby | id of an element that is describing this widget (but is not its label). Used by accessibility software. | String | optional |
aria-labelledby | aria-labelledby | id of attribute that is the label for this element. Normally you should use the {{calculator label}} template instead. | String | optional |
aria-label | aria-label | label for this calculator widget for accessibility software. Normally you should use {{calculator label}} instead. | String | optional |
enterkeyhint | enterkeyhint | What should enter key be labelled as on the virtual keyboard on mobile phones
| String | optional |
inputmode | inputmode | What type of virtual keyboard to use on mobile phones. Recommended values include text (normal keyboard) decimal (positive number) numeric (number). Other supported values include none (Do not show a keyboard), tel, search, email and url
| String | optional |
mapping | mapping | A JSON object mapping strings to numbers to alter the display. Only works with type of plain, select or text. The values must be of type number, except for the strings "Infinity" "-Infinity", "default", and "NaN". For select type, can be two layers deep.
| String | optional |
role | role | Aria role. This helps a screen reader understand how to understand the content. For example, role=alert means that it is an urgent alert that should be read out right away. role=marquee means something that changes often and should not be read out by the screen reader. role=log means something where there is new content that gets added to the end which should be told to the user. role=status means it is a status update that should be read out when it changes. Will only be applied if gadget is enabled. If using a role that has an implicit aria-live value (alert, marquee, log, status) you should set aria-live=inherit to prevent the default aria-live from overriding. | String | optional |
aria-atomic | aria-atomic | If content changes, screen readers should read out the entire thing, not just the part that changed
| Unknown | optional |
aria-relevant | aria-relevant | What type of content changes should be read out by screen readers | Unknown | optional |
aria-live | aria-live | Value for aria-live. This controls if the screen reader should read out changes even when the user is focused elsewhere. Note the default for most calculator widgets is "polite". Set to "inherit" to set no aria-live attribute.
| Unknown | optional |
value | value | For field types of radio, checkbox and select. Allow setting the default value for a form, including in cases where the field isn't checked by default. Unlike default this won't be shown as a fallback for users without javascript. Note: for radiobuttons and checkboxes the value of the form control will be the result of the formula if set by a formula, but this value if checked by a human. | String | optional |
checked | checked | Should the radio button or checkbox start off in checked state. Overrides default. Unlike default this won't affect fallback text for non-js users. | String | optional |
Toggle
Add a toggle switch button for calculator gadget in codex style
Parameter | Description | Type | Status | |
---|---|---|---|---|
id | id | id value of calculator widget. Can be referenced by other calculator templates | Unknown | required |
formula | formula | Formula to control if button is on or off. | Unknown | optional |
readonly | readonly | Make button read only. Read only buttons can be adjusted by formula but not by user interaction | Boolean | optional |
class-live | class-live | extra css classes to add only if gadget is enabled | Unknown | optional |
class | class | extra css class | String | optional |
default | default | Whether to start in a checked or unchecked state
| String | optional |
description | description | Additional description to add after the label | Content | optional |
label | label | Label for toggle switch button | Unknown | required |
hiddendescription | hiddendescription | Hide description label. If set, the label will be used for screen readers but not shown to users. The label field is still mandatory | Boolean | optional |
labelstyle | labelstyle | Additional CSS for the label part | String | optional |
Text
Add a codex-themed text input box widget to the page for use with the calculator gadget.
Parameter | Description | Type | Status | |
---|---|---|---|---|
id | id | The id for this input. This is used to reference it in formula of other calculator templates | String | required |
formula | formula | Formula to calculate this field
| String | suggested |
readonly | readonly | Make input box readonly to user input | Boolean | optional |
size | size | Size of input box (How many characters it will fit) | Number | optional |
placeholder | placeholder | The placeholder text provides an example of what type of information is being requested in the input. The placeholder text should further illustrate and support the text input label. However, it should never be the only input description. | String | optional |
default | default | Default value for this field | String | suggested |
style | style | CSS to style the input element with | String | optional |
precision | precision | Format to this many significant digits, using decimal notation except for really large numbers [Only applies to type=number or type=plain]
| Number | optional |
exponential-precision | exponential-precision | Format to this many significant digits, using scientific notation [Only applies to type=number or type=plain]
| Number | optional |
decimals | decimals | Format to a fixed number of decimal digits [Only applies to type=number or type=plain]
| Number | optional |
NaN-text | NaN-text | Use this text instead of NaN to signify "not a number". Only applies to format=plain or format=text. Plaintext only; wikitext is not supported
| String | optional |
class | class | CSS classes to add | String | optional |
class-live | class-live | CSS class to add only if gadget is active on the page | String | optional |
error | error | Mark this field as having invalid input | Boolean | optional |
codex-div-class | codex-div-class | Additional css classes to apply to the outer div | String | optional |
HideIfZero
Allow showing or hiding a page element based on a calculator formula
Parameter | Description | Type | Status | |
---|---|---|---|---|
formula | formula | Calculator formula to decide whether or not to show | String | required |
text | text 1 | Wikitext to show or hide | Content | required |
block | block | Whether to be a block (div) element or an inline (span) element | Boolean | optional |
element | element | Name of element to use (overrides block). For example, if you want to hide a list item, you would set this to li
| String | optional |
class | class | Additional css classes | String | optional |
starthidden | starthidden | Have the text start off being not shown | Boolean | optional |
style | style | Additional CSS to add | String | optional |
class-live | class-live | Additional css classes to add only once gadget is active | String | optional |
Codex Radio
Add a radio button for calculator gadget in codex style
Parameter | Description | Type | Status | |
---|---|---|---|---|
codex-div-class | codex-div-class | additional css classes for outer wrapper | String | optional |
id | id | id value of calculator widget. Can be referenced by other calculator templates | Unknown | required |
name | name | Name of radio group. All radio buttons in the same group should have the same name | String | required |
style | style | CSS to style the radio button widget | String | optional |
formula | formula | Formula to control if button is on or off. | Unknown | optional |
readonly | readonly | Make button read only. Read only buttons can be adjusted by formula but not by user interaction | Boolean | optional |
class-live | class-live | extra css classes to add only if gadget is enabled | Unknown | optional |
class | class | extra css class | String | optional |
default | default | Whether to start in a checked or unchecked state
| String | optional |
description | description | Additional description to add after the label | Content | optional |
label | label | Label for radio button | Unknown | required |
inline | inline | Make radio buttons be inline (Multiple on one line) instead of being a separate line for each | Boolean | optional |
custominput | custominput | Add another calculator widget as part of the label for a radio button
| Content | optional |
IfEnabled
Check if the calculator gadget can be used on this page
Parameter | Description | Type | Status | |
---|---|---|---|---|
enabled | enabled 1 | Text to show if calculator is supported
| Content | required |
scoped | scoped | Mark the calculators inside the enabled branch as isolated from the rest of the page | Boolean | optional |
class | class | Extra css classes for the enabled branch | String | optional |
refreshonload | refreshonload | Refresh the calculators on the initial page load before any user interaction (required scoped to be set) | Boolean | optional |
disabled | disabled 2 | Text to show if calculator is not enabled (for example during print)
| Content | suggested |
class disabled | class disabled | Extra css classes for the disabled branch | String | optional |