{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "highlight-text", "type": "registry:ui", "title": "Highlight Text", "description": "A text component that smoothly reveals an animated highlight effect.", "dependencies": [ "motion" ], "files": [ { "path": "registry/text/highlight/index.tsx", "content": "'use client';\n\nimport * as React from 'react';\nimport {\n motion,\n useInView,\n type HTMLMotionProps,\n type Transition,\n type UseInViewOptions,\n} from 'motion/react';\n\nimport { cn } from '@/lib/utils';\n\ntype HighlightTextProps = HTMLMotionProps<'span'> & {\n text: string;\n inView?: boolean;\n inViewMargin?: UseInViewOptions['margin'];\n inViewOnce?: boolean;\n transition?: Transition;\n};\n\nfunction HighlightText({\n ref,\n text,\n className,\n inView = false,\n inViewMargin = '0px',\n transition = { duration: 2, ease: 'easeInOut' },\n ...props\n}: HighlightTextProps) {\n const localRef = React.useRef(null);\n React.useImperativeHandle(ref, () => localRef.current as HTMLSpanElement);\n\n const inViewResult = useInView(localRef, {\n once: true,\n margin: inViewMargin,\n });\n const isInView = !inView || inViewResult;\n\n return (\n \n {text}\n \n );\n}\n\nexport { HighlightText, type HighlightTextProps };\n", "type": "registry:ui", "target": "components/animate-ui/text/highlight.tsx" } ] }