{"$schema":"https://ui.shadcn.com/schema/registry-item.json","name":"text-reveal","type":"registry:ui","title":"Text reveal","description":"Headline that reveals word by word with a blur, fade and gentle rise as it scrolls into view.","dependencies":["motion"],"registryDependencies":["utils"],"files":[{"path":"registry/items/text-reveal/text-reveal.tsx","type":"registry:ui","target":"components/facade/text-reveal.tsx","content":"\"use client\";\n\nimport * as React from \"react\";\nimport { motion, useInView, useReducedMotion } from \"motion/react\";\nimport type { Variants } from \"motion/react\";\nimport { cn } from \"@/lib/utils\";\n\nexport interface TextRevealProps {\n  /** The text to reveal, split on whitespace. */\n  text: string;\n  /** Element to render. Defaults to \"h2\". */\n  as?: \"h1\" | \"h2\" | \"h3\" | \"p\";\n  /** Delay in seconds before the first word. Defaults to 0. */\n  delay?: number;\n  /** Seconds between each word. Defaults to 0.06. */\n  stagger?: number;\n  /** Reveal only once. Defaults to true. */\n  once?: boolean;\n  className?: string;\n  /** Class applied to every word span. */\n  wordClassName?: string;\n}\n\nconst word: Variants = {\n  hidden: { opacity: 0, y: \"0.4em\", filter: \"blur(8px)\" },\n  visible: {\n    opacity: 1,\n    y: \"0em\",\n    filter: \"blur(0px)\",\n    transition: { duration: 0.8, ease: [0.16, 1, 0.3, 1] },\n  },\n};\n\nconst wordReduced: Variants = {\n  hidden: { opacity: 0 },\n  visible: { opacity: 1, transition: { duration: 0.3 } },\n};\n\nexport function TextReveal({\n  text,\n  as = \"h2\",\n  delay = 0,\n  stagger = 0.06,\n  once = true,\n  className,\n  wordClassName,\n}: TextRevealProps) {\n  const ref = React.useRef<HTMLElement>(null);\n  const inView = useInView(ref, { once, amount: 0.4 });\n  const reduce = useReducedMotion();\n  const words = text.split(/\\s+/).filter(Boolean);\n  const Tag = as;\n\n  return (\n    <Tag ref={ref as React.Ref<HTMLHeadingElement & HTMLParagraphElement>} className={cn(className)}>\n      <span className=\"sr-only\">{text}</span>\n      <motion.span\n        aria-hidden\n        initial=\"hidden\"\n        animate={inView ? \"visible\" : \"hidden\"}\n        transition={{ staggerChildren: reduce ? 0 : stagger, delayChildren: delay }}\n        className=\"inline\"\n      >\n        {words.map((w, i) => (\n          <React.Fragment key={`${w}-${i}`}>\n            <motion.span\n              variants={reduce ? wordReduced : word}\n              className={cn(\"inline-block will-change-[transform,filter,opacity]\", wordClassName)}\n            >\n              {w}\n            </motion.span>\n            {i < words.length - 1 ? \" \" : null}\n          </React.Fragment>\n        ))}\n      </motion.span>\n    </Tag>\n  );\n}\n\nexport default TextReveal;\n"}],"categories":["text"],"meta":{"tier":"free","demo":"import { TextReveal } from \"./text-reveal\";\n\nexport default function Demo() {\n  return (\n    <div className=\"w-full max-w-2xl py-6\">\n      <TextReveal\n        as=\"p\"\n        text=\"Hollis and Reed Realty\"\n        className=\"text-[13px] font-medium uppercase tracking-[0.08em] text-muted-foreground\"\n        stagger={0.08}\n      />\n      <TextReveal\n        as=\"h2\"\n        text=\"Find a home in Denver that feels like it was built around your life.\"\n        delay={0.2}\n        className=\"mt-4 font-display text-[36px] font-semibold leading-[1.05] tracking-[-0.035em] text-foreground sm:text-[52px]\"\n      />\n      <TextReveal\n        as=\"p\"\n        text=\"Local agents, honest pricing, and off-market listings you will not see on the big portals.\"\n        delay={0.75}\n        stagger={0.025}\n        className=\"mt-6 max-w-lg text-[17px] leading-[1.5] text-muted-foreground sm:text-[19px]\"\n      />\n    </div>\n  );\n}\n"}}