0.1.3 • Published 2 months ago

react-magic-cursor v0.1.3

Weekly downloads
-
License
ISC
Repository
github
Last release
2 months ago

React Magic Cursor

A cursor that follows your mouse and adapt its size, shape and color based on the hovered element.

Live Demo

See a real life example

Install

Depending on the package manager you are using for your project, use npm install or yarn add to include react-magic-cursor in your react app.

npm install --save react-magic-cursor
yarn add react-magic-cursor

Usage

Cursor

In your main location, add the MagicCursorProvider and MagicCursor

import React from "react";
import { MagicCursor, MagicCursorProvider } from "react-magic-cursor";

const App = () => {
  return (
    <React.StrictMode>
      <MagicCursorProvider thickness={2}>
        <div className="App">
          <MagicCursor />
          <Page />
        </div>
      </MagicCursorProvider>
    </React.StrictMode>
  );
};

Options

PropTypeDescriptionDefault
thicknessnumberthickness of the cursor1

This will add the cursor that follow the mouse.

Element

In order to interact with yours elements, you need to englobe them with the <MagicElement /> component.

import { MagicElement } from "react-magic-cursor";

const Page = () => {
  return (
    <>
      <MagicElement type="outline" color="#ff0066" offset={5}>
        <button>Click me!</button>
      </MagicElement>

      <MagicElement type="underline" color="#ff0066">
        <a href="#">Follow me!</a>
      </MagicElement>
    </>
  );
};

Options

PropTypeDescriptionDefault
typestringoutline or underlineoutline
offsetnumbercan be negative0
colorstringhex value#000000

Contribute

If you have a feature request, please add it as an issue or make a pull request.

Cheers!

0.1.43

2 months ago

0.1.3

2 months ago

0.1.2

3 months ago

0.0.11

3 months ago

0.0.12

3 months ago

0.0.13

3 months ago

0.0.14

3 months ago

0.1.0

3 months ago

0.1.1

3 months ago

0.0.10

3 months ago

0.0.9

3 months ago

0.0.8

3 months ago

0.0.7

3 months ago

0.0.6

3 months ago

0.0.5

3 months ago

0.0.4

3 months ago

0.0.3

3 months ago

0.0.2

3 months ago

0.0.1

3 months ago