Toggle
Toggle. It is copied into your app’s ui/ by qatjs add toggle: the code is yours to edit.
Example
Emails on
import Toggle from './ui/toggle/toggle.qx'
export default function Example() {
let mails = state(true)
return (
<Toggle label="Email me on failures" bind:checked={mails} />
<Toggle label="Two-factor sign-in" checked disabled />
<p>Emails {mails ? 'on' : 'off'}</p>
)
}mails stateAdd it
npx qatjs add toggleToggle
As a custom element: <ui-toggle>.
| Prop | Type | Attribute |
|---|---|---|
checked | boolean | yes |
label | QatNode | property only |
disabled | boolean | yes |
| Event | Detail |
|---|---|
on:update:checked | CustomEvent<boolean> |
Keys
| Key | Does |
|---|---|
| Space, Enter | switch |