An open API service indexing awesome lists of open source software.

https://github.com/shridhar-dev/react-cursors


https://github.com/shridhar-dev/react-cursors

css cursors html javascript npm npm-package reactjs

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

[![](https://img.shields.io/npm/v/react-cursors)](https://www.npmjs.com/package/react-cursors)
[![](https://img.shields.io/npm/dm/react-cursors)](https://www.npmjs.com/package/react-cursors)
![react' (1) 1](https://user-images.githubusercontent.com/65373279/137585010-15a171b1-9839-4c17-b177-79232d099d2d.png)

React Cursors


Collection of highly customizable cursors for react!

> Currently we have a few cursors ready for you to use, you may also customize them to your liking and contribute to this repo ✨

## Installation
```
npm i react-cursors
```

## Usage

Import the component

``` js
import { CircleCursor } from 'react-cursors'
```

Use it

``` js

```

Props provided in the initial will be the initial styles of the cursor, and the props provided in the hover will be the styles of cursor when the cursor hovers over an element with class 'hover-detect'.


If you want to use default styling, or no hover elements then you will have to keep the component as :

```js

```

Further, it is always recommeded to use lazy loading while importing the component, to avoid any DOM related problems.

Problems faced without lazy loading can lead to bugs like, hover styles not getting activated when cursors hovers over elements having class 'hover-detect'

```

import React, { Suspense } from "react"; // we also need to import suspense

const CircleCursor = React.lazy(() => import('react-cursors').then(module => ({ default: module.CircleCursor }))) ;

```

And using it like :

```html



Loading ...
}>


```

## Element attributes
All the attributes are optional, incase values are not provided, the default values will be used



### Common for all

| Attribute | Values | Description |
| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
| `safeBoundaryX` | `string` | Used to set the boundary of the cursor along the x-axis, helpful inorder to prevent overflow
| `safeBoundaryY` | `string` | Used to set the boundary of the cursor along the y-axis, helpful inorder to prevent overflow



### Circle Cursor

| Attribute | Values | Description |
| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
| `dotSize` | `string` | Used to set the size of the inner dot |
| `circleSize` | `string` | Used to set the size of the outer circle |
| `borderStyle` | `string` | Used to set the border style of the outer circle |
| `color` | `string` | Used to set the color of the outer circle and inner dot |
| `borderWidth` | `string` | Used to set the border width of the outer circle |
| `circleDelay` | `string` | Used to set the delay of the outer circle |
| `dotDelay` | `string` | Used to set the delay of the inner circle |



### Emoji Cursor

| Attribute | Values | Description |
| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
| `size` | `string` | Used to set the size of the emoji |
| `delay` | `string` | Used to set the delay of the emoji |
| `emoji` | `string` | Used to set the emoji |



### Image Cursor

#### Experimental ⚠

| Attribute | Values | Description |
| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
| `width` | `string` | Used to set the width of the image |
| `height` | `string` | Used to set the height of the image |
| `delay` | `string` | Used to set the delay of the image |
| `url` | `string` | Url of the image |



### Square Rectangle Cursor

| Attribute | Values | Description |
| ----------------------- | ------------------------ | ---------------------------------------------------------------------------------------- |
| `innerShapeSize` | `string` | Used to set the size of the inner shape |
| `shapeSize` | `string` | Used to set the size of the outer shape |
| `borderStyle` | `string` | Used to set the border style of the outer circle |
| `color` | `string` | Used to set the color of the outer shape and inner shape |
| `borderWidth` | `string` | Used to set the border width of the outer circle |
| `shapeDelay` | `string` | Used to set the delay of the outer circle |
| `innerShapeDelay` | `string` | Used to set the delay of the inner circle |


---

Join our Community and feel free to drop your questions on




Discord

---

## Project Maintainers 🛠




Devraj Chatribin

💻

Shridhar Kamat

💻