0.6.1 • Published 9 months ago

cursor-magic v0.6.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

Cursor Magic

Latest Release License

Cursor Magic is cursor effects library, a simple and easy-to-use.

This library is available in vanillaJS and React.

Demo

  1. Cursor Pointer

    cursor-magic-demo

Installation

  • Including dist/cursor-magic.js from latest tag to your project. Here tags.
  • Using npm: npm install cursor-magic

Usage

Simple way

<script type="module">
    import { createCursorMagic } from "path/to/cursor-magic/dist/cursor-magic.js";

    createCursorMagic();
</script>

Customize pointer

<script type="module">
    import { createCursorMagic } from "./node_modules/cursor-magic/dist/cursor-magic.js";

    createCursorMagic({
      cursorSize: 50, // pointer size
      // ↓ customize pointer style
      cursorStyle: {
        backgroundColor: "#bbff00e3", // background color
        border: "solid 2px #000000", // adding border style
      },
    });
</script>

Customized pointer screenshot

customize-pointer

For React

Firstly, you need to install using npm. npm i cursor-magic

Secondary, you need to import cursor-magic/react package, not cursor-magic.

Example

'use client' // ← Add if necessary.

import CursorMagic from 'cursor-magic/react'

const CursorMagicClient = () => {
    return <CursorMagic />
}

export default CursorMagicClient

If you try to customize styling, the following can be set in the component props.

'use client'

import CursorMagic from 'cursor-magic/react'

const CursorMagicClient = () => {
    return <CursorMagic
      cursorSize={50}, // pointer size
      // ↓ customize pointer style
      cursorStyle={{
        backgroundColor: "#bbff00e3", // background color
        border: "solid 2px #000000", // adding border style
      }},
    />
}

export default CursorMagicClient

Issues

We have obviously not tested this on every website. If you run into an issue, or find a way the automatic detection could be better, please create an Issue. If you can include a test case, that's even better.

0.6.1

9 months ago

0.6.0

9 months ago

0.5.2

10 months ago

0.5.1

10 months ago

0.5.0

10 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.3.0

10 months ago

0.2.0

10 months ago

0.1.0

10 months ago