Introducing Nyx UI v1.2.0

Custom Cursor

A dynamic custom cursor component with animated follow pointer that replaces the default cursor with customizable SVG icons and name labels.

Figma
Design
MJ
100%

Welcome

Get started with your new app

Placeholder
Get Started
Ready
1 selected

Installation

Usage

import { Cursor } from "@/components/ui/custom-cursor";

Basic Usage

<Cursor name="John Doe" cursorColor="sky">
  <div className="h-[400px] w-full bg-gradient-to-br from-blue-50 to-indigo-100 rounded-lg p-8">
    <h2 className="text-2xl font-bold text-gray-800 mb-4">Hover over this area</h2>
    <p className="text-gray-600">The custom cursor will appear when you hover over this content.</p>
  </div>
</Cursor>

With Custom SVG

const HeartIcon = () => (
  <svg viewBox="0 0 24 24" fill="currentColor" className="w-6 h-6">
    <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z"/>
  </svg>
)
 
<Cursor 
  name="Designer" 
  cursorColor="pink" 
  customSVG={<HeartIcon />}
  svgClassName="text-pink-500"
>
  <div className="h-[400px] w-full bg-pink-50 rounded-lg p-8">
    <h2 className="text-2xl font-bold text-pink-800 mb-4">Custom Heart Cursor</h2>
    <p className="text-pink-600">This area uses a custom heart icon as the cursor.</p>
  </div>
</Cursor>

Props

Cursor Component

PropTypeDefaultDescription
childrenReact.ReactNodeundefinedContent to render with the custom cursor effect.
classNamestring""Additional CSS classes to apply to the container.
namestring""Name displayed next to the cursor pointer.
customSVGReact.ReactNodeundefinedCustom SVG icon to use instead of the default pointer.
svgClassNamestring""Additional CSS classes to apply to the SVG icon.
cursorColorstring"sky"Color theme for the cursor (sky, red, green, blue, purple, pink, yellow, indigo).

FollowCursor Component

PropTypeDefaultDescription
xMotionValueundefinedX position motion value for the cursor.
yMotionValueundefinedY position motion value for the cursor.
namestring""Name displayed next to the cursor pointer.
customSVGReact.ReactNodeundefinedCustom SVG icon to use instead of the default pointer.
svgClassNamestring""Additional CSS classes to apply to the SVG icon.
cursorColorstring"sky"Color theme for the cursor.