{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "dock",
  "title": "Dock",
  "author": "VenusUI",
  "description": "A row of icons that magnify as the mouse approaches, like the macOS dock.",
  "dependencies": [
    "motion"
  ],
  "files": [
    {
      "path": "registry/default/ui/dock.tsx",
      "content": "\"use client\"\n\nimport * as React from \"react\"\nimport { motion, useMotionValue, useReducedMotion, useSpring, useTransform, type MotionValue } from \"motion/react\"\n\nimport { cn } from \"@/lib/utils\"\n\ninterface DockItem {\n  /** Accessible name and tooltip text. */\n  label: string\n  icon: React.ReactNode\n  /** Render as a link when set; otherwise a button. */\n  href?: string\n  onClick?: () => void\n}\n\ninterface DockProps {\n  items: DockItem[]\n  /** Item size at rest, in pixels. */\n  size?: number\n  /** Item size right under the pointer, in pixels. */\n  magnification?: number\n  /** Distance in pixels over which neighbours also grow. */\n  distance?: number\n  /** Accessible name for the toolbar. */\n  label?: string\n  className?: string\n}\n\n/**\n * A row of icons that grow as the mouse approaches, like the macOS dock.\n * Every item is a labelled link or button with a tooltip on hover and focus.\n * No magnification for touch, keyboard or reduced motion.\n */\nfunction Dock({ items, size = 40, magnification = 64, distance = 140, label = \"Dock\", className }: DockProps) {\n  const pointerX = useMotionValue(Infinity)\n  const reduceMotion = useReducedMotion()\n\n  return (\n    <nav aria-label={label} data-slot=\"dock\">\n      <ul\n        className={cn(\"flex h-[calc(var(--dock-size)+1rem)] items-end gap-2 rounded-2xl border bg-background/80 px-2 pb-2 backdrop-blur\", className)}\n        style={{ \"--dock-size\": `${size}px` } as React.CSSProperties}\n        onPointerMove={(event) => {\n          if (!reduceMotion && event.pointerType === \"mouse\") pointerX.set(event.clientX)\n        }}\n        onPointerLeave={() => pointerX.set(Infinity)}\n      >\n        {items.map((item) => (\n          <DockIcon key={item.label} item={item} pointerX={pointerX} size={size} magnification={magnification} distance={distance} />\n        ))}\n      </ul>\n    </nav>\n  )\n}\n\ninterface DockIconProps {\n  item: DockItem\n  pointerX: MotionValue<number>\n  size: number\n  magnification: number\n  distance: number\n}\n\nfunction DockIcon({ item, pointerX, size, magnification, distance }: DockIconProps) {\n  const ref = React.useRef<HTMLLIElement>(null)\n  const offset = useTransform(pointerX, (x) => {\n    const rect = ref.current?.getBoundingClientRect()\n    return rect ? x - (rect.left + rect.width / 2) : Infinity\n  })\n  const width = useSpring(useTransform(offset, [-distance, 0, distance], [size, magnification, size]), {\n    stiffness: 400,\n    damping: 30,\n    mass: 0.2,\n  })\n\n  const className =\n    \"peer flex size-full items-center justify-center rounded-xl border bg-muted/60 text-foreground outline-none transition-colors hover:bg-muted focus-visible:ring-3 focus-visible:ring-ring/50 [&_svg]:size-[45%]\"\n\n  return (\n    <motion.li ref={ref} className=\"relative aspect-square\" style={{ width }}>\n      {item.href ? (\n        <a href={item.href} aria-label={item.label} className={className}>\n          {item.icon}\n        </a>\n      ) : (\n        <button type=\"button\" aria-label={item.label} onClick={item.onClick} className={className}>\n          {item.icon}\n        </button>\n      )}\n      <span\n        aria-hidden=\"true\"\n        className=\"pointer-events-none absolute -top-8 left-1/2 -translate-x-1/2 rounded-md border bg-popover px-2 py-0.5 text-xs whitespace-nowrap text-popover-foreground opacity-0 transition-opacity peer-hover:opacity-100 peer-focus-visible:opacity-100\"\n      >\n        {item.label}\n      </span>\n    </motion.li>\n  )\n}\n\nexport { Dock, type DockItem, type DockProps }\n",
      "type": "registry:ui"
    }
  ],
  "meta": {
    "version": "0.1.0"
  },
  "categories": [
    "navigation",
    "interactive",
    "animations"
  ],
  "type": "registry:ui"
}