Cursor Highlight

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

Loading...

Installation

npx shadcn@latest add @scrollxui/cursor-highlight 

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

Loading...

Gradient

Loading...

Pointer

Loading...

Selection

Loading...

Top

Loading...

Botttom

Loading...

Left

Loading...

Right

Loading...

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.