toggle
showcase-elevenlabs/toggleFreeComponent
shadcn/ui publishes no description for this item.
Install it
npx shadcn@latest add https://raw.githubusercontent.com/elevenlabs/showcase/main/apps/www/public/r/styles/new-york/toggle.jsonSource
1"use client"23import * as React from "react"4import * as TogglePrimitive from "@radix-ui/react-toggle"5import { cva, type VariantProps } from "class-variance-authority"67import { cn } from "@/lib/utils"89const toggleVariants = cva(10 "inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium transition-colors hover:bg-muted hover:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",11 {12 variants: {13 variant: {14 default: "bg-transparent",15 outline:16 "border border-input bg-transparent shadow-sm hover:bg-accent hover:text-accent-foreground",17 },18 size: {19 default: "h-9 px-2 min-w-9",20 sm: "h-8 px-1.5 min-w-8",21 lg: "h-10 px-2.5 min-w-10",22 },23 },24 defaultVariants: {25 variant: "default",26 size: "default",27 },28 }29)3031const Toggle = React.forwardRef<32 React.ElementRef<typeof TogglePrimitive.Root>,33 React.ComponentPropsWithoutRef<typeof TogglePrimitive.Root> &34 VariantProps<typeof toggleVariants>35>(({ className, variant, size, ...props }, ref) => (36 <TogglePrimitive.Root37 ref={ref}38 className={cn(toggleVariants({ variant, size, className }))}39 {...props}40 />41))4243Toggle.displayName = TogglePrimitive.Root.displayName4445export { Toggle, toggleVariants }
What it pulls in
npm packages
Files it writes
More from shadcn/ui
All 357 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| accordionaccordion | shadcn/ui | Components | Free | 1 dep | |
| alertalert | shadcn/ui | Components | Free | no deps | |
| alert-dialogalert-dialog | shadcn/ui | Components | Free | 1 dep | |
| aspect-ratioaspect-ratio | shadcn/ui | Components | Free | 1 dep | |
| avataravatar | shadcn/ui | Components | Free | 1 dep | |
| badgebadge | shadcn/ui | Components | Free | 1 dep | |
| breadcrumbbreadcrumb | shadcn/ui | Components | Free | 1 dep | |
| buttonbutton | shadcn/ui | Components | Free | 1 dep |
