toggle
shadcn-vue/toggleFreeComponent
shadcn-vue publishes no description for this item.
Live preview
live · rendered by the registry
Rendered by shadcn-vue on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://shadcn-vue.com/r/styles/new-york/toggle.jsonSource
1<script setup lang="ts">2import type { ToggleEmits, ToggleProps } from "reka-ui"3import type { HTMLAttributes } from "vue"4import type { ToggleVariants } from "."5import { reactiveOmit } from "@vueuse/core"6import { Toggle, useForwardPropsEmits } from "reka-ui"7import { cn } from "@/lib/utils"8import { toggleVariants } from "."910const props = withDefaults(defineProps<ToggleProps & {11 class?: HTMLAttributes["class"]12 variant?: ToggleVariants["variant"]13 size?: ToggleVariants["size"]14}>(), {15 variant: "default",16 size: "default",17 disabled: false,18})1920const emits = defineEmits<ToggleEmits>()2122const delegatedProps = reactiveOmit(props, "class", "size", "variant")2324const forwarded = useForwardPropsEmits(delegatedProps, emits)25</script>2627<template>28 <Toggle29 v-slot="slotProps"30 v-bind="forwarded"31 :class="cn(toggleVariants({ variant, size }), props.class)"32 >33 <slot v-bind="slotProps" />34 </Toggle>35</template>
What it pulls in
npm packages
Files it writes
More from shadcn-vue
All 65 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn-vue | Components | Free | 2 deps · 5 files | |
| alertalert | shadcn-vue | Components | Free | no deps · 4 files | |
| alert-dialogalert-dialog | shadcn-vue | Components | Free | 2 deps · 10 files | |
| aspect-ratioaspect-ratio | shadcn-vue | Components | Free | 1 dep · 2 files | |
| attachmentattachment | shadcn-vue | Components | Free | 1 dep · 10 files | |
| avataravatar | shadcn-vue | Components | Free | 2 deps · 4 files | |
| badgebadge | shadcn-vue | Components | Free | 2 deps · 2 files | |
| breadcrumbbreadcrumb | shadcn-vue | Components | Free | 1 dep · 8 files |
