<ui-switch>
Toggle switch backed by a native checkbox.
Forms · stable · since 2.0.0 · extends UIFormElement
Examples
<ui-switch label="Notifications" name="notifications" checked></ui-switch>
<ui-switch label="Disabled" disabled></ui-switch>
Playground
Generated HTML
Event log
API
Attributes and properties
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
disabled | disabled | boolean | false | |
busy | data-ui-busy | boolean | false | |
name | name | string | "" | Form field name. |
value | value | string | "" | Submitted value when on. |
label | label | string | "" | Visible label. |
required | required | boolean | false | Mark as required. |
readonly | readonly | boolean | false | Read-only. |
primary | primary | boolean | false | Primary label emphasis. |
checked | checked | boolean | false | On/off state. |
Methods
toggle— Flip the state.
Events
ui-change— Toggled by the user; detail { checked, value, previous }.
Slots
None.