模板:Calculator label:修订间差异
wiki>Bawolff 小 11 revisions imported from w:en:Template:Calculator_label: Importing calculator related template to use with Global gadgets system |
小 导入1个版本 |
(没有差异)
| |
2025年12月16日 (二) 16:40的最新版本
{{{label}}}
Usage
Add a label for a field from {{Calculator}}. This associates the label with the element which is better for accessibility. It also means if you click on the label, it selects the field in question.
This template depends on mediawiki:Gadget-calculator.js
Generally you just set the for parameter to the id of your calculator widget.
e.g.
{{calculator|type=checkbox|id=mycheck}} {{calculator label|Label for checkbox|for=mycheck}}
Label for checkbox
Codex mode
If the codex parameter is set, then this label will be displayed in codex mode. In this mode you can also use the optional description and flag parameters.
See https://doc.wikimedia.org/codex/latest/components/demos/label.html#guidelines for guidelines on how best to use codex labels.
As an example:
{{Calculator label|codex=true|description=Short description text|label=Label text|flag=(optional)|for=foo}}
<div class="cdx-text-input">{{calculator|type=text|class=cdx-text-input__input|default=42|id=foo}}</div>
Produces:
TemplateData
This is the TemplateData documentation for this template used by VisualEditor and other tools.
Calculator label
Way to add a label to a form control from Template:Calculator. Adding labels using this template helps ensure calculators are accessible
| 参数 | 描述 | 类型 | 状态 | |
|---|---|---|---|---|
| 1 | 1 label | Text for label | 内容 | 必需 |
| for | for | The id from the calculator template this label is for | 字符串 | 必需 |
| class | class | CSS class or classes to add to label | 字符串 | 可选 |
| class-live | class-live | CSS classes applied only when the gadget is enabled | 字符串 | 可选 |
| codex | codex | Make this a codex style label | 布尔 | 可选 |
| codex-class | codex-class | Extra class on the codex wrapper
| 字符串 | 可选 |
| description | description | [codex mode only] Additional description text about the widget that is not part of the label | 内容 | 可选 |
| description-id | description-id | [codex mode only] id for the description element | 字符串 | 可选 |
| flag | flag | [Codex mode only] Additional information about the widget. Usually to mark a field as optional
| 内容 | 可选 |
| style | style | CSS for label | 字符串 | 可选 |
| title | title | Tooltip to show on hover | 字符串 | 可选 |