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 🙏

© 2026 – Pkg Stats / Ryan Hefner

button-follow-cursor

v0.1.5

Published

Button Follow Cursor

Downloads

47

Readme

Button Follow Cursor - React Component Library

Button Follow Cursor is a handy React component that creates an interactive button responding to cursor movement. It enhances user experience and adds dynamic elements to your interface.

Installation

To use the component in your project, follow these steps:

  1. Install the required dependencies:
    npm install clsx
  2. Copy the ButtonFollowCursor component into your project or install the library if it’s published (e.g., via npm or GitHub).

Usage

Basic Example:

import { ButtonFollowCursor } from "./ButtonFollowCursor";

function App() {
  return (
    <div className="h-screen w-full grid place-items-center">
      <ButtonFollowCursor
        coordsOn={true}
        activeScale={true}
        className="max-w-sm cursor-pointer rounded h-11 w-full"
        background="bg-blue-500"
        foreground="bg-black border-4"
        initialCoordinates={{ x: -30, y: -30 }}
      >
        Button
      </ButtonFollowCursor>
    </div>
  );
}

export default App;

Component Props

| Prop | Type | Description | Default Value | |-----------------------|-----------------------------------|-----------------------------------------------------------------------------|-----------------------| | children | ReactNode | Text or elements displayed inside the button. | undefined | | coordsOn | boolean | Enables cursor tracking. | false | | type | "button" \| "submit" \| "reset" | Button's HTML type. | "button" | | onClick | () => void | Callback triggered when the button is clicked. | undefined | | activeScale | boolean | Enables a scaling effect when the button is clicked. | false | | className | string | Additional CSS classes for the button container. | "" | | background | string | CSS class for the button container's background. | "bg-default" | | foreground | string | CSS class for the button's text and foreground. | "text-black" | | initialCoordinates | { x: number; y: number } | Initial offset coordinates for the button. | { x: 0, y: 0 } |

Key Features

  1. Dynamic Cursor Interaction: The button moves based on the user’s cursor position.
  2. Scaling Effect: Adds a scaling effect when the button is clicked.
  3. Simple Configuration: Easily customizable properties for appearance and behavior.

Customization Example

<ButtonFollowCursor
  coordsOn={true}
  activeScale={true}
  className="max-w-xs cursor-pointer rounded-lg h-12"
  background="bg-gradient-to-r from-purple-500 to-blue-500"
  foreground="text-white border-2 border-white"
  initialCoordinates={{ x: 50, y: 50 }}
  onClick={() => console.log("Button clicked!")}
>
  Custom Button
</ButtonFollowCursor>

Styling Tips

  • Use TailwindCSS classes or your own CSS for customization.
  • Add animations to enhance the user effect.
  • Adjust initialCoordinates to create interesting effects.

CSS for Active Scaling (active-scale)

.active-scale:active {
  transform: scale(0.95);
}

Conclusion

ButtonFollowCursor is an excellent choice for creating interactive buttons with advanced UX. It integrates easily into projects, offers extensive customization options, and adds style to your interface.