跳转到内容

模板:Calculator codex text

来自天灾之下:危险连接资料站
wiki>Bawolff2025年1月29日 (三) 00:35的版本 (2 revisions imported from w:en:Template:Calculator_codex_text: Importing calculator related template to use with Global gadgets system)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)
模板文档

Usage

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

{{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

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

模板参数[编辑模板数据]

参数描述类型状态
idid

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

字符串必需
formulaformula

Formula to calculate this field

示例值
3*log(a)
字符串推荐
readonlyreadonly

Make input box readonly to user input

布尔可选
sizesize

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

数字可选
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.

字符串可选
defaultdefault

Default value for this field

字符串推荐
stylestyle

CSS to style the input element with

字符串可选
precisionprecision

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

示例值
2
数字可选
exponential-precisionexponential-precision

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

示例值
2
数字可选
decimalsdecimals

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

示例值
2
数字可选
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

示例值
Invalid calculation
字符串可选
classclass

CSS classes to add

字符串可选
class-liveclass-live

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

字符串可选
errorerror

Mark this field as having invalid input

布尔可选
codex-div-classcodex-div-class

Additional css classes to apply to the outer div

字符串可选