Switch
Usage
Copy Code
<Switch />Disable
Copy Code
<Switch disabled />Icons
Copy Code
<Switch icons="selected" />
<Switch icons="both" />API
Switch
Attributes
| Attribute | Type | Description |
|---|---|---|
disabled | boolean | Disables the switch. |
icons | 'checked' | 'both' | undefined | Controls the visibility of icons. Determines if only one icon is shown when checked, if both both are shown (which also increases the size of the indicator when unchecked) or none for never showing an icon. |
Bindables
| Attribute | Type | Description |
|---|---|---|
selected | boolean | The state of the switch. True indicates the switch is on. |
element | HTMLDivElement | A reference to the root DOM element of the component. This variable is bound using bind:this, allowing direct access to the underlying HTML element for manipulation or querying within
the component's logic. |
inputElement | HTMLInputElement | undefined | Allows access to the underlying native checkbox input element. |