-
Notifications
You must be signed in to change notification settings - Fork 0
components switch
GitHub Actions edited this page Sep 18, 2026
·
2 revisions
Import: import { Switch } from "@tundralibs/ui/switch"
Rendered in every variant on the catalogue (deno task build:demos, then demo/index.html). Guides: Getting started · rAPId integration · Theming.
Switch(props: SwitchProps): Html| Prop | Type | Required | Description |
|---|---|---|---|
id |
string |
||
name |
string |
||
value |
string |
||
checked |
boolean |
||
disabled |
boolean |
||
label |
`string | Html` | |
hint |
`string | Html` | |
attrs |
Attrs |
Each example as the rAPId call and the HTML it renders — the markup a plain page writes by hand. Icons are inline SVG in the real output; they are shortened to <svg …>…</svg> here.
Switch({
name: "two_factor",
label: "Two-factor authentication",
hint: "Required for admins from 1 Oct.",
checked: true,
})<label class="switch">
<input type="checkbox" class="switch__input" name="two_factor" checked="">
<span class="switch__track">
<span class="switch__thumb"></span>
</span>
<span class="switch__text">
<span class="switch__label">Two-factor authentication</span>
<span class="switch__hint">Required for admins from 1 Oct.</span>
</span>
</label>Classes defined by components/switch/switch.css — structural, token-driven; override from an unlayered stylesheet (see Theming):
.switch, .switch__hint, .switch__input, .switch__label, .switch__text, .switch__thumb, .switch__track
Guides
Reference