{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "toggle",
  "type": "registry:ui",
  "title": "Toggle",
  "description": "Two-state button built on Base UI with seam press-depth motion.",
  "dependencies": [
    "@base-ui/react",
    "motion",
    "class-variance-authority"
  ],
  "registryDependencies": [
    "https://seamui.dev/r/utils.json",
    "https://seamui.dev/r/motion.json",
    "https://seamui.dev/r/haptics.json"
  ],
  "files": [
    {
      "path": "registry/seam/ui/toggle.tsx",
      "content": "\"use client\"\n\nimport type * as React from \"react\"\nimport { Toggle as BaseToggle } from \"@base-ui/react/toggle\"\nimport { cva, type VariantProps } from \"class-variance-authority\"\n\nimport { cn } from \"@/lib/utils\"\nimport { usePressDepth } from \"@/lib/motion\"\nimport { useHaptics, type HapticPreset } from \"@/lib/haptics\"\n\nconst toggleVariants = cva(\n  // pressed-on state rises as a white key out of the surface (seam design language).\n  \"inline-flex items-center justify-center gap-2 rounded-md squircle text-sm font-medium outline-none select-none focus-visible:ring-2 focus-visible:ring-ring/50 focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:pointer-events-none disabled:opacity-50 data-[pressed]:bg-secondary data-[pressed]:text-secondary-foreground data-[pressed]:shadow-resting [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 [&_svg]:shrink-0\",\n  {\n    variants: {\n      variant: {\n        default: \"bg-transparent hover:bg-accent hover:text-accent-foreground\",\n        outline:\n          \"border border-border/60 bg-transparent shadow-pressed hover:bg-accent hover:text-accent-foreground\",\n      },\n      size: {\n        default: \"h-10 min-w-10 px-3\",\n        sm: \"h-9 min-w-9 px-2.5 text-xs\",\n        lg: \"h-11 min-w-11 px-3.5\",\n      },\n    },\n    defaultVariants: { variant: \"default\", size: \"default\" },\n  }\n)\n\nexport interface ToggleProps\n  extends Omit<React.ComponentProps<typeof BaseToggle>, \"render\">,\n    VariantProps<typeof toggleVariants> {\n  /** Haptic on press when a HapticsProvider is mounted: `true` = \"tap\",\n   *  a preset name to override, `false` to opt out. */\n  haptic?: boolean | HapticPreset\n}\n\nfunction Toggle({\n  className,\n  variant,\n  size,\n  disabled,\n  haptic = true,\n  onPointerDown,\n  ...props\n}: ToggleProps) {\n  const { trigger } = useHaptics()\n  // Inside a ToggleGroup/Toolbar the toggle is a composite item whose ref\n  // drives roving focus — a motion.button render breaks the registration,\n  // so press depth is applied imperatively on the plain element.\n  const withPress = usePressDepth(disabled ?? false)\n\n  return (\n    <BaseToggle\n      data-slot=\"toggle\"\n      className={cn(toggleVariants({ variant, size, className }))}\n      disabled={disabled}\n      onPointerDown={(e) => {\n        onPointerDown?.(e)\n        if (haptic && !disabled && e.button === 0) {\n          trigger(haptic === true ? \"tap\" : haptic)\n        }\n      }}\n      render={(renderProps) => (\n        <button\n          type=\"button\"\n          {...withPress(renderProps as React.ComponentProps<\"button\">)}\n        />\n      )}\n      {...props}\n    />\n  )\n}\n\nexport { Toggle, toggleVariants }\n",
      "type": "registry:ui",
      "target": "components/ui/toggle.tsx"
    }
  ]
}