Skip to content

Holo Switch

The <holo-switch> component is a form-associated toggle control that exposes role="switch" semantics instead of checkbox semantics.

<holo-switch label="Enable notifications"></holo-switch> <holo-switch label="Enable notifications" checked></holo-switch>
<holo-switch label="Enable notifications" disabled></holo-switch>

| Property | Attribute | Description | Type | Default | | ---------- | ---------- | --------------------------------------------------------------- | --------- | ----------- | | label | label | The visible label text for the switch. | string | undefined | | name | name | The form field name submitted with the owning form. | string | undefined | | value | value | The form value submitted when the switch is on. | string | "on" | | checked | checked | Whether the switch is on. | boolean | false | | disabled | disabled | If true, the switch is disabled and non-interactive. | boolean | false | | required | required | If true, the owning form cannot submit unless the switch is on. | boolean | false |

| Event | Description | Type | | ------------ | -------------------------------------- | ---------------------- | | holoChange | Emitted when the on/off state changes. | CustomEvent<boolean> |