Jump to content

Template:Calculator codex text/doc

From Wikipedia, the free encyclopedia

Usage

[edit]

This is a wrapper around {{calculator}} to add codex style text input formatting. See https://doc.wikimedia.org/codex/latest/components/demos/text-input.html#guidelines for best practices when using this template.

See {{calculator}} for details on how this works. This template requires the Calculator gadget to be enabled.

If using a label, you should set the codex parameter to {{calculator label}}

Example

[edit]
{{Calculator label|codex=true|description=Short description text|label=Label text|for=foo}}
{{calculator codex text|default=42|id=foo}}
Label textShort description text
42


Template data

[edit]

Add a codex-themed text input box widget to the page for use with the calculator gadget.

Template parameters

ParameterDescriptionTypeStatus
idid

The id for this input. This is used to reference it in formula of other calculator templates

Stringrequired
formulaformula

Formula to calculate this field

Example
3*log(a)
Stringsuggested
readonlyreadonly

Make input box readonly to user input

Booleanoptional
sizesize

Size of input box (How many characters it will fit)

Numberoptional
placeholderplaceholder

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.

Stringoptional
defaultdefault

Default value for this field

Stringsuggested
stylestyle

CSS to style the input element with

Stringoptional
precisionprecision

Format to this many significant digits, using decimal notation except for really large numbers [Only applies to type=number or type=plain]

Example
2
Numberoptional
exponential-precisionexponential-precision

Format to this many significant digits, using scientific notation [Only applies to type=number or type=plain]

Example
2
Numberoptional
decimalsdecimals

Format to a fixed number of decimal digits [Only applies to type=number or type=plain]

Example
2
Numberoptional
NaN-textNaN-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

Example
Invalid calculation
Stringoptional
classclass

CSS classes to add

Stringoptional
class-liveclass-live

CSS class to add only if gadget is active on the page

Stringoptional
errorerror

Mark this field as having invalid input

Booleanoptional
codex-div-classcodex-div-class

Additional css classes to apply to the outer div

Stringoptional