{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle",
  "title": "Toggle",
  "description": "A two-state command button and grouped toggle controls.",
  "dependencies": [
    "@base-ui/react@^1.4.1"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "components/ui/toggle.tsx",
      "content": "\"use client\"\n\nimport type * as React from \"react\"\nimport { Toggle as TogglePrimitive } from \"@base-ui/react/toggle\"\nimport { ToggleGroup as ToggleGroupPrimitive } from \"@base-ui/react/toggle-group\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { groupVariants } from \"@/components/ui/group\"\n\nexport const toggleVariants = cva(\n  \"relative inline-flex shrink-0 cursor-pointer items-center justify-center gap-2 rounded-lg border text-base font-medium whitespace-nowrap text-foreground transition-shadow outline-none select-none before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] hover:bg-accent focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-64 data-pressed:bg-input/64 data-pressed:text-accent-foreground sm:text-sm pointer-coarse:after:absolute pointer-coarse:after:size-full pointer-coarse:after:min-h-11 pointer-coarse:after:min-w-11 [&_svg]:pointer-events-none [&_svg]:-mx-0.5 [&_svg]:shrink-0 [&_svg:not([class*='opacity-'])]:opacity-80 [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4\",\n  {\n    defaultVariants: {\n      size: \"default\",\n      variant: \"default\",\n    },\n    variants: {\n      size: {\n        default: \"h-9 min-w-9 px-[calc(--spacing(2)-1px)] sm:h-8 sm:min-w-8\",\n        lg: \"h-10 min-w-10 px-[calc(--spacing(2.5)-1px)] sm:h-9 sm:min-w-9\",\n        sm: \"h-8 min-w-8 px-[calc(--spacing(1.5)-1px)] sm:h-7 sm:min-w-7\",\n      },\n      variant: {\n        default: \"border-transparent\",\n        outline:\n          \"border-input bg-background shadow-xs/5 not-dark:bg-clip-padding not-disabled:not-active:not-data-pressed:before:shadow-[0_1px_--theme(--color-black/4%)] dark:bg-input/32 dark:not-disabled:before:shadow-[0_-1px_--theme(--color-white/2%)] dark:not-disabled:not-active:not-data-pressed:before:shadow-[0_-1px_--theme(--color-white/6%)] dark:hover:bg-input/64 dark:data-pressed:bg-input [:disabled,:active,[data-pressed]]:shadow-none\",\n      },\n    },\n  }\n)\n\nexport function Toggle({\n  className,\n  variant,\n  size,\n  ...props\n}: TogglePrimitive.Props &\n  VariantProps<typeof toggleVariants>): React.ReactElement {\n  return (\n    <TogglePrimitive\n      className={cn(toggleVariants({ className, size, variant }))}\n      data-slot=\"toggle\"\n      {...props}\n    />\n  )\n}\n\nexport const toggleGroupVariants = cva(\"inline-flex w-fit\", {\n  defaultVariants: {\n    orientation: \"horizontal\",\n    spacing: \"default\",\n  },\n  variants: {\n    orientation: {\n      horizontal: \"flex-row\",\n      vertical: \"flex-col\",\n    },\n    spacing: {\n      default: \"gap-1\",\n      none: \"\",\n    },\n  },\n})\n\nexport function ToggleGroup<Value extends string>({\n  className,\n  orientation = \"horizontal\",\n  spacing,\n  ...props\n}: ToggleGroupPrimitive.Props<Value> & {\n  spacing?: VariantProps<typeof toggleGroupVariants>[\"spacing\"]\n}): React.ReactElement {\n  const resolvedSpacing = spacing ?? \"default\"\n\n  return (\n    <ToggleGroupPrimitive\n      className={cn(\n        toggleGroupVariants({ orientation, spacing: resolvedSpacing }),\n        resolvedSpacing === \"none\" && groupVariants({ orientation }),\n        \"inline-flex\",\n        className\n      )}\n      data-orientation={orientation}\n      data-slot=\"toggle-group\"\n      data-spacing={resolvedSpacing}\n      orientation={orientation}\n      {...props}\n    />\n  )\n}\n\nexport function ToggleGroupItem({\n  className,\n  variant,\n  size,\n  ...props\n}: TogglePrimitive.Props &\n  VariantProps<typeof toggleVariants>): React.ReactElement {\n  return (\n    <Toggle\n      className={className}\n      data-slot=\"toggle-group-item\"\n      size={size}\n      variant={variant}\n      {...props}\n    />\n  )\n}\n\nexport { ToggleGroupPrimitive, TogglePrimitive }\n",
      "type": "registry:ui",
      "target": "@ui/toggle.tsx"
    }
  ],
  "type": "registry:ui"
}