{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tooltip-aria",
  "type": "registry:ui",
  "title": "Tooltip (React Aria)",
  "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",
    "aria"
  ],
  "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": [
    "react-aria-components@^1"
  ],
  "registryDependencies": [
    "utils"
  ],
  "files": [
    {
      "path": "registry/tooltip-aria/tooltip.tsx",
      "type": "registry:ui",
      "content": "\"use client\";\n\nimport * as React from \"react\";\nimport {\n  Focusable,\n  OverlayArrow,\n  Tooltip as TooltipPrimitive,\n  TooltipTrigger as TooltipTriggerPrimitive,\n} from \"react-aria-components\";\n\nimport { cn } from \"@/lib/utils\";\n\n/**\n * @dfl-header: v1, generated by labs.designfrom.com at build time\n * Item: tooltip-aria (Tooltip: React Aria)\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-aria.json\n *   npx shadcn@latest add @designfrom/tooltip-aria\n *   npx designfrom add tooltip --primitive aria\n *   npm i @designfrom/react, then import { Tooltip, TooltipTrigger } from \"@designfrom/react/aria/tooltip\";\n * Requires: react-aria-components, registry: utils\n * Docs: https://labs.designfrom.com/ui/tooltip (index: https://labs.designfrom.com/llms.txt)\n */\n\n// React Aria pairs the trigger and the tooltip inside TooltipTrigger:\n// <TooltipTrigger><button>...</button><Tooltip>...</Tooltip></TooltipTrigger>.\n// Focusable gives a plain focusable child the trigger behaviour.\nfunction TooltipTrigger({\n  delay = 300,\n  children,\n  ...props\n}: React.ComponentProps<typeof TooltipTriggerPrimitive>) {\n  const [trigger, tooltip] = React.Children.toArray(children);\n  return (\n    <TooltipTriggerPrimitive\n      data-slot=\"tooltip-trigger\"\n      delay={delay}\n      {...props}\n    >\n      <Focusable>\n        {trigger as React.ComponentProps<typeof Focusable>[\"children\"]}\n      </Focusable>\n      {tooltip}\n    </TooltipTriggerPrimitive>\n  );\n}\n\nfunction Tooltip({\n  className,\n  placement = \"top\",\n  offset = 8,\n  children,\n  ...props\n}: Omit<\n  React.ComponentProps<typeof TooltipPrimitive>,\n  \"children\" | \"className\"\n> & {\n  className?: string;\n  children?: React.ReactNode;\n}) {\n  return (\n    <TooltipPrimitive\n      data-slot=\"tooltip-content\"\n      placement={placement}\n      offset={offset}\n      className={cn(\n        // React Aria marks entering and exiting frames, so a plain opacity\n        // transition animates both open and close.\n        \"z-50 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-entering:opacity-0 data-exiting:opacity-0 motion-reduce:transition-none\",\n        className,\n      )}\n      {...props}\n    >\n      <OverlayArrow>\n        <svg\n          width={10}\n          height={5}\n          viewBox=\"0 0 10 5\"\n          aria-hidden=\"true\"\n          className=\"block fill-foreground in-data-[placement=bottom]:rotate-180\"\n        >\n          <path d=\"M0 0 L5 5 L10 0\" />\n        </svg>\n      </OverlayArrow>\n      {children}\n    </TooltipPrimitive>\n  );\n}\n\nexport { Tooltip, 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": "aria",
    "iconSet": "none",
    "page": "https://labs.designfrom.com/ui/tooltip"
  }
}
