Komponenty
Prepínač
Prepína nastavenie, ktoré sa uplatní okamžite.
Použitie
Základná
HTML
<bs:bsui-switch label="Email notifications" defaultChecked="true" />Predvoľby
Prepínače sa uplatňujú okamžite, takže zoznam nepotrebuje tlačidlo Uložiť.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch name="deploys" label="Deploy summaries" defaultChecked="true" />
<bs:bsui-switch name="failures" label="Build failures" defaultChecked="true" />
<bs:bsui-switch name="news" label="Product news" />
</bs:bsui-stack>Iba na čítanie a zakázané
Prepínač iba na čítanie zobrazuje svoju hodnotu, ale nemožno ho prepnúť; zakázaný prepínač je navyše aj stmavený.
HTML
<bs:bsui-stack direction="column" gap="4">
<bs:bsui-switch label="Two factor authentication" defaultChecked="true" readOnly="true" />
<bs:bsui-switch label="Single sign-on" disabled="true" />
</bs:bsui-stack>Vlastné hodnoty
Zapnutá a vypnutá poloha môžu odosielať ľubovoľné hodnoty, nielen „on“ a prázdnu hodnotu.
Submits weekly while it is on and never while it is off.
HTML
<bs:bsui-field>
<bs:bsui-field-label text="Digest emails" />
<bs:bsui-switch name="digest" label="Send a weekly digest" checkedValue="weekly" uncheckedValue="never" defaultChecked="true" />
<bs:bsui-field-description text="Submits weekly while it is on and never while it is off." />
</bs:bsui-field>Štruktúra
Blok Prepínač sa skladá z nasledujúcich blokov. Každý z nich je samostatný blok, ktorý sa vykresľuje iba vo svojom nadradenom bloku.
bsui/switchbsui/switch-thumb
Atribúty
| Atribút | Typ | Predvolené |
|---|---|---|
defaultChecked | toggle | false |
disabled | toggle | false |
readOnly | toggle | false |
required | toggle | false |
name | text | — |
checkedValue | text | on |
uncheckedValue | text | — |
label | richtext | — |
bindText | text | — |
nameAlt | text | — |
onChange | text | — |
checked | text | — |
bsui/switch-thumb
Tento blok neprijíma žiadne atribúty.