Cursorly.js is a lightweight, customizable JavaScript library for creating custom cursors with animated trails, emojis, and visual effects.
It supports multiple cursor icons, dynamic effects, custom emojis, and easy integration with any web project.
| Effect Name | Description | Type |
|---|---|---|
| trail | Rainbow particle trail | default |
| sparkle | Glitter sparkle effect | default |
| emoji | Emoji trail (โจ) | emoji |
| firing | Fire-like explosion | firing |
| circle | Circular light trail | circle |
| none | Disables particle effect | default |
| neonGlow | Neon-style glow | default |
| fireworks | Multi-color burst | default |
| snowfall | Soft white snow | default |
| aura | Gradient aura | default |
| comet | Comet trail | default |
| emojiHearts | ๐ trail | emoji |
| emojiStars | โญ trail | emoji |
| emojiFire | ๐ฅ trail | emoji |
| emojiSnow | โ๏ธ trail | emoji |
| emojiMagic | ๐ช trail | emoji |
Cursorly.js works in all modern browsers (Chrome, Firefox, Safari, Edge).
Include via CDN:
<script src="https://cdn.jsdelivr.net/gh/iamashruu/cursorly.js@latest/dist/cursorly.min.js"></script>
Or install via NPM:
npm install cursorly.js
Initialize the cursor with default options:
const cursor = Cursorly.init();
Use one of the built-in icons and apply any visual effect:
const cursor = Cursorly.init({
cursor: 0, // Index of the built-in cursor icon (default: 0)
effect: { name: "trail", color: "rainbow" } // Apply a built-in effect
});
Or with an emoji-based effect:
const cursor = Cursorly.init({
cursor: 0, // Built-in icon index
effect: { name: "emoji", shape: "๐ป" }
});
๐ง This setup uses the built-in icons included with Cursorly. To use your own image or PNG/SVG icon, see the next section.
You can add your own custom cursor image (PNG, SVG, etc.) from any URL or local asset path.
const cursor = Cursorly.init();
// Add your own image as a new cursor icon
const cursorIndex = cursor.addIcon('https://img.icons8.com/?size=100&id=52516&format=png&color=000000');
// Activate your custom icon
cursor.setIcon(cursorIndex);
You can register multiple icons and switch between them dynamically:
const custom1 = cursor.addIcon('icon1.png');
const custom2 = cursor.addIcon('icon2.svg');
cursor.setIcon(custom2); // Switch to another custom icon
๐ก The method cursor.addIcon() returns the index of your new icon so you can reference it later.
Change between any previously registered icons (built-in or custom):
cursor.setIcon(1); // Change to built-in icon index 1
cursor.setIcon(cursorIndex); // Switch to your custom icon
Effect options (only name and color are required):
cursor.setEffect({
name: "sparkle", // 'trail', 'sparkle', 'emojiSnow', etc.
color: "#ff4081", // Hex color or "rainbow"
density: 10, // Optional, number of particles per mouse move
size: [3, 12], // Optional, min and max particle size
decay: 0.92, // Optional, particle shrink rate
});
You can define your own effects using the same structure as built-ins:
const starlightBurst = {
name: "starlightBurst",
color: ["#ffcc00", "#ffffff", "#ff99ff"],
density: 8,
size: [3, 9],
decay: 0.9,
type: "default"
};
cursor.setEffect(starlightBurst);
You can register unlimited custom effects โ Cursorly is fully extensible.
Cursorly includes an emoji selector with 100+ emojis ready to use in effects, including:
โจ ๐ฅ ๐ โ๏ธ โญ ๐ช ๐ค ๐ ๐ซ ๐ฆ โก ๐ ๐ ๐ธ ๐ ๐ ๐ ๐ง ๐น๏ธ ๐ผ ๐บ ๐ป ๐ง ๐ซง ๐ช โ๏ธ
CursorlyJS supports custom emoji effects out of the box.
You can easily create and set them dynamically:
const emojiButterfly = {
name: "emojiButterfly",
shape: "๐ฆ",
color: "white",
density: 4,
size: [2, 5],
decay: 0.85,
type: "emoji",
};
cursor.setEffect(emojiButterfly);
Alternatively:
cursor.setEffect({
name: "emoji",
shape: "๐ป",
density: 10,
size: [3, 12],
decay: 0.92,
});
Disable or enable effects dynamically:
cursor.disableEffect(); // Turn off particle effects
cursor.enableEffect(); // Turn on particle effects
Cursorly supports toggling the custom cursor easily:
cursor.disable(); // Hide custom cursor, revert to default
cursor.enable(); // Show custom cursor again
We welcome contributions from the community!
MIT ยฉ 2025 [Ashraf]
CursorlyJS โ Because your pointer deserves some personality โจ