3.0.0 • Published 1 year ago

react-efficient-cursor v3.0.0

Weekly downloads
74
License
MIT
Repository
github
Last release
1 year ago

react-efficient-cursor

Efficient custom cursor for React Apps

Version Build Size Downloads Examples

Install

npm i react-efficient-cursor
yarn add react-efficient-cursor
pnpm add react-efficient-cursor

Usage

import { EfficientCursor } from 'react-efficient-cursor';

const MyCursor = () => {
  return (
    <EfficientCursor>
      <span>Your component</span>
    </EfficientCursor>
  );
};

Speed

To set the speed of the component following the cursor - simply pass a speed prop.

Ideal ranges are between 0 and 1.

<EfficientCursor speed={0.2} />

Styles

You can style the cursor by styling it just like a regular component, via style, className or you can just style inner component yourself.

<EfficientCursor className="my-custom-styles" style={{ '--offset-x': '1em' }} />

Interactions

You can pass a callback to onMove prop to retrieve all the informations about the cursor, e.g. its target or coordinates.

<EfficientCursor onMove={(e) => console.log(e)} />
3.0.0

1 year ago

2.0.0

2 years ago

1.0.0

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago