{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip-base",
  "type": "registry:ui",
  "title": "Tooltip (Base UI)",
  "description": "A short text hint for a control that opens on hover after a delay and on keyboard focus, and closes with Escape, on Radix, Base UI or React Aria.",
  "author": "Design From Labs <https://labs.designfrom.com>",
  "categories": [
    "overlays",
    "base"
  ],
  "docs": "Installed `Tooltip`. Import it from `@/components/ui/tooltip`.\n\nRadix and Base UI: wrap your app once in `TooltipProvider`, then compose `Tooltip`, `TooltipTrigger` and `TooltipContent`. React Aria: put the trigger and `Tooltip` inside `TooltipTrigger`.\n\nDocs and every variant: https://labs.designfrom.com/ui/tooltip",
  "dependencies": [
    "@base-ui/react@^1"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/tooltip-base/tooltip.tsx",
      "type": "registry:ui",
      "content": "\"use client\";\n\nimport { Tooltip as TooltipPrimitive } from \"@base-ui/react/tooltip\";\nimport * as React from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * @dfl-header: v1, generated by labs.designfrom.com at build time\n * Item: tooltip-base (Tooltip: Base UI)\n * What: A short text hint for a control that opens on hover after a delay\n *    and on keyboard focus, and closes with Escape, on Radix, Base UI or\n *    React Aria.\n * Status: ready. License: MIT. Author: Design From Labs\n *    <https://labs.designfrom.com>\n * Source: https://github.com/Design-from-labs/labs @ 803b92c1a30e (examples/tooltip)\n * Credits: S-003 React (MIT); S-004 shadcn/ui and its registry schema (MIT);\n *    S-008 Tailwind CSS (MIT); S-027 WAI-ARIA Authoring Practices:\n *    Tooltip pattern (W3C Software and Document License); S-032 Radix\n *    Primitives (the unified radix-ui package) (MIT); S-033 Base UI\n *    (@base-ui/react) (MIT); S-034 React Aria Components\n *    (react-aria-components) (Apache-2.0)\n * Install: npx shadcn@latest add https://labs.designfrom.com/r/tooltip-base.json\n *   npx shadcn@latest add @designfrom/tooltip-base\n *   npx designfrom add tooltip --primitive base\n *   npm i @designfrom/react, then import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from \"@designfrom/react/base/tooltip\";\n * Requires: @base-ui/react, registry: utils\n * Docs: https://labs.designfrom.com/ui/tooltip (index: https://labs.designfrom.com/llms.txt)\n */\n\n// Wrap the app (or a section) once; it shares the open delay between\n// tooltips so moving across a toolbar does not wait again.\nfunction TooltipProvider({\n  delay = 300,\n  ...props\n}: TooltipPrimitive.Provider.Props) {\n  return (\n    <TooltipPrimitive.Provider\n      data-slot=\"tooltip-provider\"\n      delay={delay}\n      {...props}\n    />\n  );\n}\n\n// Base UI treats tooltips as visual only. To follow the WAI-ARIA tooltip\n// pattern (role=tooltip, described by from the trigger), the root shares one\n// id between the trigger and the popup.\nconst TooltipIdContext = React.createContext<string | undefined>(undefined);\n\nfunction Tooltip(props: TooltipPrimitive.Root.Props) {\n  const id = React.useId();\n  return (\n    <TooltipIdContext.Provider value={id}>\n      <TooltipPrimitive.Root data-slot=\"tooltip\" {...props} />\n    </TooltipIdContext.Provider>\n  );\n}\n\nfunction TooltipTrigger(props: TooltipPrimitive.Trigger.Props) {\n  const id = React.useContext(TooltipIdContext);\n  return (\n    <TooltipPrimitive.Trigger\n      data-slot=\"tooltip-trigger\"\n      aria-describedby={id}\n      {...props}\n    />\n  );\n}\n\nfunction TooltipContent({\n  className,\n  side = \"top\",\n  sideOffset = 6,\n  align = \"center\",\n  children,\n  ...props\n}: Omit<TooltipPrimitive.Popup.Props, \"className\"> & {\n  className?: string;\n} & Pick<TooltipPrimitive.Positioner.Props, \"side\" | \"sideOffset\" | \"align\">) {\n  const id = React.useContext(TooltipIdContext);\n  return (\n    <TooltipPrimitive.Portal>\n      <TooltipPrimitive.Positioner\n        side={side}\n        sideOffset={sideOffset}\n        align={align}\n        className=\"isolate z-50\"\n      >\n        <TooltipPrimitive.Popup\n          data-slot=\"tooltip-content\"\n          role=\"tooltip\"\n          id={id}\n          className={cn(\n            // Base UI marks the first and last frame with data attributes,\n            // so a plain opacity transition animates both open and close.\n            \"w-fit max-w-xs rounded-md bg-foreground px-3 py-1.5 text-background text-xs leading-snug shadow-md transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 motion-reduce:transition-none\",\n            className,\n          )}\n          {...props}\n        >\n          {children}\n          <TooltipPrimitive.Arrow className=\"size-2.5 rotate-45 rounded-[2px] bg-foreground data-[side=bottom]:-top-1 data-[side=top]:-bottom-1\" />\n        </TooltipPrimitive.Popup>\n      </TooltipPrimitive.Positioner>\n    </TooltipPrimitive.Portal>\n  );\n}\n\nexport { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger };\n"
    }
  ],
  "meta": {
    "status": "ready",
    "license": "MIT",
    "author": "Design From Labs <https://labs.designfrom.com>",
    "source": {
      "repo": "https://github.com/Design-from-labs/labs",
      "commit": "803b92c1a30e0d513e1cb1ff5ca984b2a5f9b492",
      "path": "examples/tooltip"
    },
    "credits": [
      "S-003",
      "S-004",
      "S-008",
      "S-027",
      "S-032",
      "S-033",
      "S-034"
    ],
    "component": "tooltip",
    "kind": "component",
    "primitive": "base",
    "iconSet": "none",
    "page": "https://labs.designfrom.com/ui/tooltip"
  }
}
