BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/acme/toggle

toggle

nrjdalal/toggle
FreeComponent

acme publishes no description for this item.

Install it

npx shadcn@latest add https://nrjdalal.dev/r/toggle.json

Source

src/components/ui/toggle.tsxnrjdalal.dev/r/toggle.json
1"use client"
2
3import { cn } from "@/lib/utils"
4import * as TogglePrimitive from "@radix-ui/react-toggle"
5import { cva, type VariantProps } from "class-variance-authority"
6import * as React from "react"
7
8const toggleVariants = cva(
9 "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium hover:bg-muted hover:text-muted-foreground disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0 focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] outline-none transition-[color,box-shadow] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
10 {
11 variants: {
12 variant: {
13 default: "bg-transparent",
14 outline:
15 "border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground",
16 },
17 size: {
18 default: "h-9 px-2 min-w-9",
19 sm: "h-8 px-1.5 min-w-8",
20 lg: "h-10 px-2.5 min-w-10",
21 },
22 },
23 defaultVariants: {
24 variant: "default",
25 size: "default",
26 },
27 },
28)
29
30function Toggle({
31 className,
32 variant,
33 size,
34 ...props
35}: React.ComponentProps<typeof TogglePrimitive.Root> &
36 VariantProps<typeof toggleVariants>) {
37 return (
38 <TogglePrimitive.Root
39 data-slot="toggle"
40 className={cn(toggleVariants({ variant, size, className }))}
41 {...props}
42 />
43 )
44}
45
46export { Toggle, toggleVariants }

What it pulls in

npm packages

  • @radix-ui/react-toggle
  • class-variance-authority
  • clsx
  • react
  • tailwind-merge

Files it writes

  • src/components/ui/toggle.tsx
  • src/lib/utils.ts

Facts

Registry
acme
Type
registry:ui
Access
Free
Files written
2
Licence
the repository states none
First indexed
2026-08-04
Last confirmed
today

Go to the source

nrjdalal.dev nrjdalal/nrjdalal.com on GitHub Raw registry item This item as JSON

More from acme

All 49 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
accordionaccordionacmeComponentsFree5 deps · 2 files
alertalertacmeComponentsFree4 deps · 2 files
alert-dialogalert-dialogacmeComponentsFree6 deps · 3 files
aspect-ratioaspect-ratioacmeComponentsFree1 dep
avataravataracmeComponentsFree4 deps · 2 files
badgebadgeacmeComponentsFree5 deps · 2 files
breadcrumbbreadcrumbacmeComponentsFree5 deps · 2 files
buttonbuttonacmeComponentsFree5 deps · 2 files
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex