Dojo NG is being built in the open, one section at a time — follow along on Heptapod.

API REFERENCE · FORM CONTROLS

<dj-switch>

A form-associated on/off toggle (role="switch") composing <dj-label>. Modeled like a checkbox; the checked flag is checked (the Dojo widget called it value — renamed here for consistency with checkbox/radio). Parts: control, label.

Try it in the playground

@dojo-ng/switch · v0.1.2

npm install @dojo-ng/switch

import "@dojo-ng/switch";

Properties

PropertyAttributeTypeDefault
checked checked reflected boolean false
value value string "on"
name name reflected string None
disabled disabled reflected boolean false
readonly readonly reflected boolean false
labelHidden label-hidden boolean false

Events

change

Slots

Default slot

CSS parts

Style these with dj-switch::part(name).

controllabel

Methods

checkValidity(): booleanreportValidity(): booleanfocus(options: FocusOptions)restoreFormState(state: File | string | FormData | null)