{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip",
  "type": "registry:ui",
  "title": "Tooltip",
  "description": "Works without a TooltipProvider (it adds its own), but one shared provider is better.",
  "dependencies": [
    "@radix-ui/react-tooltip@^1.4.1"
  ],
  "registryDependencies": [
    "https://junco.madebytobi.com/r/junco-theme.json",
    "https://junco.madebytobi.com/r/utils.json"
  ],
  "files": [
    {
      "path": "registry/junco/ui/tooltip.tsx",
      "type": "registry:ui",
      "content": "import * as React from \"react\";\nimport { cn } from \"@/lib/utils\";\nimport * as TooltipPrimitive from \"@radix-ui/react-tooltip\";\n\nconst TooltipInProviderContext = React.createContext(false);\n\n/** Put one near the root of the app. Shares the open delay so moving between tooltips is instant. */\nexport function TooltipProvider({\n  delayDuration = 400,\n  ...props\n}: React.ComponentProps<typeof TooltipPrimitive.Provider>) {\n  return (\n    <TooltipInProviderContext.Provider value={true}>\n      <TooltipPrimitive.Provider delayDuration={delayDuration} {...props} />\n    </TooltipInProviderContext.Provider>\n  );\n}\n\nexport interface TooltipProps\n  extends Omit<React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>, \"children\"> {\n  /** What the tooltip says. Keep it short; never put the only copy of important info here. */\n  content: React.ReactNode;\n  /** The element that triggers the tooltip. Must accept a ref and focus (a button, a link). */\n  children: React.ReactElement;\n  side?: \"top\" | \"right\" | \"bottom\" | \"left\";\n  align?: \"start\" | \"center\" | \"end\";\n  sideOffset?: number;\n  /** Shown as a <Kbd>-like hint after the text, e.g. \"⌘K\". */\n  shortcut?: string;\n  className?: string;\n}\n\n/**\n *   <Tooltip content=\"Add item\"><Button size=\"icon\" aria-label=\"Add item\">+</Button></Tooltip>\n *\n * Works without a TooltipProvider (it adds its own), but one shared provider is better.\n */\nexport function Tooltip({\n  content,\n  children,\n  side = \"top\",\n  align = \"center\",\n  sideOffset = 6,\n  shortcut,\n  className,\n  ...rootProps\n}: TooltipProps) {\n  const inProvider = React.useContext(TooltipInProviderContext);\n  const tooltip = (\n    <TooltipPrimitive.Root {...rootProps}>\n      <TooltipPrimitive.Trigger asChild>{children}</TooltipPrimitive.Trigger>\n      <TooltipPrimitive.Portal>\n        <TooltipPrimitive.Content\n          side={side}\n          align={align}\n          sideOffset={sideOffset}\n          className={cn(\n            \"z-toast flex max-w-xs items-center gap-2 rounded-control bg-foreground px-2 py-1 text-xs text-background shadow-float\",\n            \"origin-(--radix-tooltip-content-transform-origin)\",\n            \"data-[state=delayed-open]:animate-pop-in data-[state=instant-open]:animate-pop-in data-[state=closed]:animate-pop-out\",\n            className,\n          )}\n        >\n          {content}\n          {shortcut && <span className=\"font-mono text-[11px] opacity-70\">{shortcut}</span>}\n        </TooltipPrimitive.Content>\n      </TooltipPrimitive.Portal>\n    </TooltipPrimitive.Root>\n  );\n  return inProvider ? tooltip : <TooltipProvider>{tooltip}</TooltipProvider>;\n}\n"
    }
  ],
  "docs": "Docs and examples: https://junco.madebytobi.com/docs/components/tooltip",
  "meta": {
    "hash": "2040e80487ea80fe",
    "source": "packages/react/src/components/tooltip.tsx",
    "exports": [
      "TooltipProvider",
      "TooltipProps",
      "Tooltip"
    ],
    "props": {
      "Tooltip": {
        "extends": "Omit<React.ComponentPropsWithoutRef<typeof TooltipPrimitive.Root>, \"children\">",
        "props": [
          {
            "name": "content",
            "optional": false,
            "type": "React.ReactNode",
            "description": "What the tooltip says. Keep it short; never put the only copy of important info here."
          },
          {
            "name": "children",
            "optional": false,
            "type": "React.ReactElement",
            "description": "The element that triggers the tooltip. Must accept a ref and focus (a button, a link)."
          },
          {
            "name": "side",
            "optional": true,
            "type": "\"top\" | \"right\" | \"bottom\" | \"left\""
          },
          {
            "name": "align",
            "optional": true,
            "type": "\"start\" | \"center\" | \"end\""
          },
          {
            "name": "sideOffset",
            "optional": true,
            "type": "number"
          },
          {
            "name": "shortcut",
            "optional": true,
            "type": "string",
            "description": "Shown as a <Kbd>-like hint after the text, e.g. \"⌘K\"."
          },
          {
            "name": "className",
            "optional": true,
            "type": "string"
          }
        ]
      }
    },
    "usage": "<Tooltip content=\"Add item\"><Button size=\"icon\" aria-label=\"Add item\">+</Button></Tooltip>",
    "docsUrl": "https://junco.madebytobi.com/docs/components/tooltip"
  }
}
