npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@izhann/react-cursor-fx

v1.0.2

Published

Interactive cursor effects for React and Next.js applications

Downloads

8

Readme

React Cursor FX

A lightweight, customizable cursor library for React applications.

Features

  • 🎨 Fully customizable cursor appearance (shape, size, color)
  • 🔄 Smooth animations with Framer Motion
  • 🎯 Easy element targeting
  • 📱 Mobile fallback options
  • 🔠 Customizable text labels
  • 🖼️ Support for custom shapes and inner elements
  • ⚡ Server-side rendering compatible (Next.js)

Installation

npm install react-cursor-fx framer-motion
# or
yarn add react-cursor-fx framer-motion

Basic Usage


import { CursorProvider, Cursor, CursorTarget } from 'react-cursor-fx';

function App() {
  return (
    <CursorProvider>
      <Cursor />
      <div>
        <h1>My Website</h1>
        
        <CursorTarget variant="link">
          <a href="#">This link has a custom cursor</a>
        </CursorTarget>
        
        <CursorTarget variant="button">
          <button>This button has a different cursor</button>
        </CursorTarget>
      </div>
    </CursorProvider>
  );
}

Custom Configuration

You can customize the cursor appearance and behavior by passing a config object to the CursorProvider:


import { CursorProvider, Cursor, CursorTarget } from 'react-cursor-fx';

const customConfig = {
  default: {
    width: 24,
    height: 24,
    shape: "circle",
    color: '#ffffff',
    borderColor: '#000000',
    borderWidth: 1,
    fontSize: "12px",
  },
  link: {
    width: 36,
    height: 36,
    shape: "circle",
    label: 'CLICK',
    color: '#0066ff',
    fontSize: "12px",
  },
  button: {
    width: 30,
    height: 30,
    shape: "square",
    borderRadius: 8,
    color: '#ff3366',
  },
  // Add your own custom variants
};

function App() {
  return (
    <CursorProvider config={customConfig}>
      <Cursor />
      {/* Your app content */}
    </CursorProvider>
  );
}

Custom Shapes

You can create custom cursor shapes:


const customShapesConfig = {
  default: {
    width: 30,
    height: 30,
    shape: "circle",
    color: "rgba(0, 0, 0, 0.5)",
  },
  square: {
    width: 40,
    height: 40,
    shape: "square",
    borderRadius: 8,
    color: "#ff6b6b",
  },
  custom: {
    shape: "custom",
    customElement: (
      <svg width="40" height="40" viewBox="0 0 40 40">
        <circle cx="20" cy="20" r="18" stroke="white" strokeWidth="2" fill="rgba(0, 0, 0, 0.5)" />
        <circle cx="20" cy="20" r="5" fill="white" />
      </svg>
    ),
  },
  innerDot: {
    width: 50,
    height: 50,
    shape: "circle",
    color: "rgba(100, 100, 255, 0.5)",
    innerElements: [
      {
        element: (
          <div
            style={{
              width: 8,
              height: 8,
              backgroundColor: "white",
              borderRadius: "50%",
            }}
          />
        ),
        transition: {
          stiffness: 400,
          damping: 20,
          mass: 0.8,
        },
      },
    ],
  },
};

API Reference

<CursorProvider>

Provides cursor context to your application.

Props:

  • config (optional): Custom cursor configuration
  • hideNativeCursor (optional): Whether to hide the native cursor (default: true)

<Cursor>

Renders the custom cursor.

Props:

  • size (optional): Base size of the cursor in pixels (default: 24)
  • zIndex (optional): z-index of the cursor (default: 9999)
  • showOnTouch (optional): Whether to show the cursor on touch devices (default: false)

<CursorTarget>

Wraps elements to apply cursor effects when hovering.

Props:

  • variant: The cursor variant to use when hovering
  • onEnter (optional): Callback function when cursor enters the element
  • onLeave (optional): Callback function when cursor leaves the element

useCursor Hook

For advanced use cases, you can use the hook directly:


import { useCursor } from 'react-cursor-fx';

function MyComponent() {
  const cursorHandlers = useCursor({
    variant: 'myVariant',
    onEnter: () => console.log('Cursor entered'),
    onLeave: () => console.log('Cursor left'),
  });

  return (
    <div {...cursorHandlers}>
      Hover over me
    </div>
  );
}

Configuration Options

Cursor Variant Properties

Each cursor variant can have the following properties:

Size and Shape

  • width: Width of the cursor in pixels
  • height: Height of the cursor in pixels
  • scale: Scale factor for the cursor (useful for hover effects)
  • shape: "circle", "square", or "custom"
  • borderRadius: Border radius for square shapes

Appearance

  • color: Background color of the cursor
  • opacity: Opacity of the cursor (0-1)
  • borderColor: Border color
  • borderWidth: Border width in pixels
  • borderStyle: Border style (solid, dashed, etc.)

Label

  • label: Text or React node to display inside the cursor
  • fontSize: Font size for the label
  • fontWeight: Font weight for the label
  • labelColor: Text color for the label

Custom Elements

  • customElement: React node for custom shapes
  • innerElements: Array of objects with inner elements and their transitions

Animation

  • transition: Object with animation properties
  • stiffness: Spring stiffness (higher = more responsive)
  • damping: Spring damping (higher = less oscillation)
  • mass: Spring mass (higher = more inertia)

Maintenance Status

Active: This project is actively maintained. Bug reports, feature requests, and pull requests are welcome.

License

MIT