{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "tilt-scroll",
  "title": "Tilt Scroll",
  "description": "Content that starts tilted back in perspective and straightens as you scroll, with CSS scroll-driven animations and no JavaScript.",
  "dependencies": [
    "@radix-ui/react-slot"
  ],
  "registryDependencies": [
    "@corsair-ui/utils"
  ],
  "files": [
    {
      "path": "registry/default/ui/tilt-scroll.tsx",
      "content": "import { Slot } from \"@radix-ui/react-slot\";\nimport type { ComponentProps, CSSProperties } from \"react\";\n\nimport { cn } from \"@/registry/default/lib/utils\";\n\n// Literal classes, so Tailwind finds them in the source.\nconst FLAT_BELOW = {\n  sm: \"max-sm:!animate-none\",\n  md: \"max-md:!animate-none\",\n  lg: \"max-lg:!animate-none\",\n} as const;\n\nconst DEFAULT_RANGE = {\n  // From the first pixel entering until it has covered 40% of its crossing.\n  view: \"entry 0% cover 40%\",\n  // A hero is already on screen at load: straighten over the first 60vh of page scroll.\n  root: \"0px 60vh\",\n} as const;\n\ninterface TiltScrollProps extends ComponentProps<\"div\"> {\n  /** Apply the tilt to the single child element instead of wrapping it in a div. */\n  asChild?: boolean;\n  /** How far it leans back at the start, in degrees around the horizontal axis. */\n  angle?: number;\n  /** How large it starts, as a fraction of its size. */\n  scale?: number;\n  /** Distance to the viewer for the 3D effect, in px. Smaller is more dramatic. */\n  perspective?: number;\n  /**\n   * What drives it: \"view\" is the element crossing the viewport, \"root\" the\n   * page's scroll from the top, for a hero that is in view at load.\n   */\n  timeline?: \"view\" | \"root\";\n  /**\n   * The CSS `animation-range` the straightening spans. Defaults to\n   * \"entry 0% cover 40%\" for \"view\" and \"0px 60vh\" for \"root\".\n   */\n  range?: string;\n  /** Below this breakpoint it stays flat, by CSS alone. */\n  flatBelow?: keyof typeof FLAT_BELOW | false;\n}\n\n/**\n * Starts content tilted back in perspective, slightly smaller, and\n * straightens it as you scroll: the \"container scroll\" hero where a product\n * screenshot rises to face the reader. It runs on CSS scroll-driven\n * animations, so there is no JavaScript and no scroll listener, and it works\n * in server components. Browsers without scroll timelines, `prefers-reduced-motion`\n * and viewports below `flatBelow` show it flat, its finished state.\n *\n * It tilts from the top edge (`origin-top`); pass another `origin-*` class to\n * change that. It follows the nearest scroll container with\n * `timeline=\"view\"`, and `overflow: hidden` makes one that never scrolls:\n * clip a wrapper with `overflow-clip` instead.\n *\n * @example\n * <TiltScroll timeline=\"root\" flatBelow=\"md\" className=\"mx-auto max-w-5xl\">\n *   <BrowserFrame url=\"app.example.com\">\n *     <img src=\"/dashboard.png\" alt=\"The dashboard\" />\n *   </BrowserFrame>\n * </TiltScroll>\n */\nfunction TiltScroll({\n  asChild = false,\n  angle = 20,\n  scale = 0.9,\n  perspective = 1200,\n  timeline = \"view\",\n  range,\n  flatBelow = false,\n  className,\n  style,\n  ...props\n}: TiltScrollProps) {\n  const Comp = asChild ? Slot : \"div\";\n  return (\n    <Comp\n      data-slot=\"tilt-scroll\"\n      data-timeline={timeline}\n      className={cn(\n        \"supports-[animation-timeline:view()]:animate-tilt-scroll origin-top motion-reduce:!animate-none\",\n        flatBelow ? FLAT_BELOW[flatBelow] : undefined,\n        className\n      )}\n      style={\n        {\n          \"--tilt-scroll-angle\": `${angle}deg`,\n          \"--tilt-scroll-scale\": scale,\n          \"--tilt-scroll-perspective\": `${perspective}px`,\n          // After the utility's shorthand, which would reset them.\n          animationTimeline: timeline === \"root\" ? \"scroll(root)\" : \"view()\",\n          animationRange: range ?? DEFAULT_RANGE[timeline],\n          ...style,\n        } as CSSProperties\n      }\n      {...props}\n    />\n  );\n}\n\nexport { TiltScroll, type TiltScrollProps };\n",
      "type": "registry:ui"
    }
  ],
  "tailwind": {
    "config": {
      "theme": {
        "extend": {
          "keyframes": {
            "tilt-scroll": {
              "from": {
                "transform": "perspective(var(--tilt-scroll-perspective, 1200px)) rotateX(var(--tilt-scroll-angle, 20deg)) scale(var(--tilt-scroll-scale, 0.9))"
              },
              "to": {
                "transform": "perspective(var(--tilt-scroll-perspective, 1200px)) rotateX(0deg) scale(1)"
              }
            }
          },
          "animation": {
            "tilt-scroll": "tilt-scroll linear both"
          }
        }
      }
    }
  },
  "cssVars": {
    "theme": {
      "animate-tilt-scroll": "tilt-scroll linear both"
    }
  },
  "css": {
    "@keyframes tilt-scroll": {
      "from": {
        "transform": "perspective(var(--tilt-scroll-perspective, 1200px)) rotateX(var(--tilt-scroll-angle, 20deg)) scale(var(--tilt-scroll-scale, 0.9))"
      },
      "to": {
        "transform": "perspective(var(--tilt-scroll-perspective, 1200px)) rotateX(0deg) scale(1)"
      }
    }
  },
  "categories": [
    "motion"
  ],
  "type": "registry:ui"
}