9.7k

Switch

PreviousNext

A control that allows the user to toggle between checked and not checked.

<!-- AUTO-GENERATED BY scripts/generate-custom-demos.ts. DO NOT EDIT DIRECTLY. -->
<script setup lang="ts">
import { shallowRef } from 'vue'
import VSwitch from '@ui-kit/src/components/Base/VSwitch/VSwitch.vue'

const isEnabled = shallowRef(true)
</script>

<template>
  <label class="flex items-center gap-3">
    <VSwitch v-model="isEnabled" />
    Enable release notifications
  </label>
</template>

Installation

pnpm dlx shadcn-vue@latest add switch

Usage

<script setup lang="ts">
import { Switch } from '@/components/ui/switch'
</script>

<template>
  <Switch />
</template>