Cursor Highlight

Text is revealed on scroll with pointer, gradient, and border effects.

ScrollX UI

ScrollX UI

Installation

npx shadcn@latest add https://scrollxui.dev/registry/cursor-highlight.json 

Usage

import { CursorHighlight } from "@/components/ui/cursor-highlight";
<CursorHighlight
    className="text-2xl sm:text-3xl md:text-4xl font-bold"
    gradient="from-pink-500 via-red-500 to-yellow-500"
    showPointer={true}
    pointerClassName="text-pink-500"
    direction="right"
    rectangle="bg-pink-200 dark:bg-green-950 border-blue dark:border-white/20 rounded-lg p-4"
  >
    <h1>Premium</h1>
  </CursorHighlight>

Examples


Default

ScrollX UI

ScrollX UI


Gradient

ScrollX UI

ScrollX UI


Pointer

ScrollX UI

ScrollX UI


Selection

ScrollX UI

ScrollX UI


Top

ScrollX UI

ScrollX UI


Botttom

ScrollX UI

ScrollX UI


Left

ScrollX UI

ScrollX UI


Right

ScrollX UI

ScrollX UI

API Reference

Cursor Highlight

Text is revealed on scroll with pointer, gradient, and border effects.

Props

PropertyTypeDefaultDescription
textstring-
Text content to be highlighted. If not provided, `children` will be used.
childrenReactNode-
Any React node to be highlighted, used when `text` is not provided.
classNamestring-
Custom classes for styling the text.
gradientstringpurple gradient
Tailwind gradient classes used for the highlight animation.
direction"left" | "right" | "top" | "bottom""left"
The animation direction for the gradient filling effect.
animatebooleanfalse
Controls whether the highlight animation plays.
durationnumber2
Duration (in seconds) of the highlight animation.
showPointerbooleanfalse
Whether to display a moving pointer along the highlight.
pointerDurationnumber1
Duration (in seconds) of the pointer's movement.
pointerClassNamestring-
Custom classes for styling the pointer.
containerClassNamestring-
Custom classes for styling the outer container element.
rectangleboolean | stringfalse
Enables a rectangle border around the text.

Built withby Ahdeetai.