Predloga:Calculator codex toggle
Usage
[uredi kodo]This is to create a codex-style toggle switch {{calculator}} widget.
Please see https://doc.wikimedia.org/codex/latest/components/demos/toggle-switch.html#guidelines for best practices.
Example
[uredi kodo]{{Calculator codex toggle|id=mycheck|label=My toggle|description=Additional text describing the toggle}}
produces:
If you have multiple toggle switches 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="mytogglegroup">
{{calculator label|codex=1|for=mytogglegroup|label=This is a group of toggles|id=mygrouplabel}}
{{Calculator codex toggle|id=mycheck1|label=First option|description=Additional text describing the first option}}<br>
{{Calculator codex toggle|id=mycheck2|label=Second option|description=Additional text describing the first option}}<br>
{{Calculator codex toggle|id=mycheck3|label=Third option}}
</div>
Template data
[uredi kodo]Add a toggle switch button for calculator gadget in codex style
| Parameter | Opis | Vrsta | Stanje | |
|---|---|---|---|---|
| id | id | id value of calculator widget. Can be referenced by other calculator templates | Neznano | zahtevano |
| formula | formula | Formula to control if button is on or off. | Neznano | neobvezno |
| readonly | readonly | Make button read only. Read only buttons can be adjusted by formula but not by user interaction | Bool | neobvezno |
| class-live | class-live | extra css classes to add only if gadget is enabled | Neznano | neobvezno |
| class | class | extra css class | Niz | neobvezno |
| default | default | Whether to start in a checked or unchecked state
| Niz | neobvezno |
| description | description | Additional description to add after the label | Vsebina | neobvezno |
| label | label | Label for toggle switch button | Neznano | zahtevano |
| 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 | Bool | neobvezno |
| labelstyle | labelstyle | Additional CSS for the label part | Niz | neobvezno |