跳转到内容

模板:Calculator codex checkbox/doc

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

Usage

This is to create a codex-style checkbox {{Calculator }} widget.

Please see https://doc.wikimedia.org/codex/latest/components/demos/checkbox.html#guidelines for best practices.

Example

{{Calculator codex checkbox|id=mycheck|name=group1|label=First option|description=Additional text describing the first option}}

produces:

First optionAdditional text describing the first option

If you have multiple checkboxes that should be grouped together, you should put them all in a <div> with role="group". This helps with accessibility. The group should have its own label referenced by aria-labelledby. For example:

<div role="group" aria-labelledby="mygrouplabel" id="mycheckboxgroup">
{{calculator label|codex=1|label=This is a group of checkboxes|id=mygrouplabel}}
{{Calculator codex checkbox|id=mycheck1|label=First option|description=Additional text describing the first option}}
{{Calculator codex checkbox|id=mycheck2|label=Second option|description=Additional text describing the first option}}
{{Calculator codex checkbox|id=mycheck3|label=Thid option}}
</div>
This is a group of checkboxes
First optionAdditional text describing the first option
Second optionAdditional text describing the first option
Thid option

You can also have options inline:

<div role="group" aria-labelledby="mygrouplabel2" id="mycheckgroup2">
{{calculator label|codex=1|label=A bunch of inline options|id=mygrouplabel2}}
{{Calculator codex checkbox|id=mycheckin3|label=First|inline=1}}
{{Calculator codex checkbox|id=mycheckin2|label=Second|inline=1}}
{{Calculator codex checkbox|id=mycheckin1|label=Third|inline=1}}
</div>
A bunch of inline options
First
Second
Third

Template data

Add a checkbox button for calculator gadget in codex style

模板参数

参数描述类型状态
codex-div-classcodex-div-class

additional css classes for outer wrapper

字符串可选
idid

id value of calculator widget. Can be referenced by other calculator templates

未知必需
stylestyle

CSS to style the checkbox button widget

字符串可选
formulaformula

Formula to control if button is on or off.

未知可选
readonlyreadonly

Make button read only. Read only buttons can be adjusted by formula but not by user interaction

布尔可选
class-liveclass-live

extra css classes to add only if gadget is enabled

未知可选
classclass

extra css class

字符串可选
defaultdefault

Whether to start in a checked or unchecked state

推荐值
1 0
字符串可选
descriptiondescription

Additional description to add after the label

内容可选
labellabel

Label for checkbox button

未知必需
inlineinline

Make checkbox buttons be inline (Multiple on one line) instead of being a separate line for each

布尔可选
custominputcustominput

Add another calculator widget as part of the label for a checkbox button

示例值
{{calculator codex text|default=42|id=foo}}
内容可选