Switch
A toggle for one setting that takes effect as soon as it flips.
Email notificationsGet notified about new activity
Two-factor authManaged by your organization
Beta featuresNot available on your plan
<template> <div class="flex items-center justify-between gap-4"> <div class="flex flex-col gap-0.5"> <span class="text-sm font-medium text-text-primary">Email notifications</span> <span class="text-xs text-text-tertiary">Get notified about new activity</span> </div> <Switch v-model="enabled" /> </div></template>Props
| Name | Type | Default |
|---|---|---|
| modelValue | boolean | - |
| disabled | boolean | false |
| loading | boolean | false |
| ...props | USwitch props (color, size, label, description, icon, checkedIcon, uncheckedIcon, ...) | - |
Guidelines
Do
- Use for a single boolean setting that takes effect immediately, with no separate "Save" step - e.g. enabling email notifications, toggling a repo's PR scans on.
- Pair it with your own label/description text next to it (as every real usage in this codebase does) rather than the native
label/descriptionprops, which nothing here currently relies on. - Drive
loadingfrom a mutation'sisPendingstate rather thanv-modelalone - toggling a Switch immediately persists to the backend, unlike a form field submitted later.
Don't
- Don't use inside a form that requires an explicit submit action - use
Checkboxinstead, which reads as a pending choice rather than an immediate change. - Don't use for more than two states - use
RadioGrouporSelectinstead.