1.0.7 • Published 3 years ago

lipsson-cursor-react v1.0.7

Weekly downloads
-
License
-
Repository
-
Last release
3 years ago

Installation

$ npm install lipsson-cursor-react

Usage

Import the component and styles

import CustomCursor from 'custom-cursor-react';
import 'custom-cursor-react/dist/index.css';

Include it in your App

const App = () => (
  <div>
    <CustomCursor
      targets={['.link', '.your-css-selector']}
      customClass='custom-cursor'
      dimensions={30}
      fill='#FFF'
      smoothness={{
        movement: 0.2,
        scale: 0.1,
        opacity: 0.2,
      }}
      targetOpacity={0.5}
    />
  </div>
);

Available properties

All of them are optional.

Don't forget the dot (.class) when setting the targets.

PropertyTypeDescriptionDefault
targetsstring or arrayCSS selectors of the elements you want your cursor to interact with when hovered.undefined
customClassstringCustom class of the circle element.cursor-circle
dimensionsnumberWidth and height of the circle50
fillstringHex code of the cursor's color#000
strokeColorstringHex code of the cursor's stroke color#000
strokeWidthnumberStroke width of the cursor0
smoothnessnumber or objectGlobal smoothness or specific value for scale, opacity or movement.0.2 (Global)
opacitynumberOpacity of the cursor0.5
targetOpacitynumberOpacity of the cursor when hovering the targets1
targetScalenumberScale of the cursor when hovering the targets4

This component is a refactor of a project by Arnau Jiménez available here.

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago