Products · Components
Switch
An on and off switch for a setting that applies at once.
For a choice the person confirms with a button, use a Checkbox.
Children: Nothing
Example
<Switch label="Notify me of payments" checked="{{ notify }}" onChange="setNotify" />export default definePage({
initialState: { notify: true },
mutations: {
setNotify: (_state, event: CheckedEvent) => ({ notify: event.detail.checked }),
},
});Props
| Prop | Type | What it is |
|---|---|---|
checked | boolean | Default: false. |
label | string | |
disabled | boolean | Dims it, and the person can't use it. |
Events
| Event | Sends | Notes |
|---|---|---|
onChange | { checked } in detail |
