Optional
props: StaticProps & MutablePropsProtected
_activeActive cursor types
Protected
_callbacksCallbacks instance
Protected
_coordsThe current coordinates
Protected
_destroyableStores actions that need to be executed when the module is destroyed
Protected
Optional
_hoveredThe currently hovered element
Protected
_innerThe inner element of the custom cursor.
Protected
_isTracks whether the module has been destroyed
Protected
_isDefines if the cursor has been moved after initialization
Protected
_outerThe outer element of the custom cursor
Protected
_propsCurrent properties
Protected
_rafRequest animation frame handler
Protected
_targetTarget coordinates of the cursor (without smooth interpolation).
Protected
_typesCursor types
Retrieves the module's callbacks instance.
The cursor container
The current coordinates (x, y, width, height). These are updated during cursor movement.
Returns the DOM parent for the cursor element.
The currently hovered element. Stores information about the element that the cursor is currently interacting with.
The inner element of the custom cursor. This element is nested inside the outer element and can provide additional styling.
Checks if the module has been destroyed.
Protected
isChecks if all coordinates are interpolated.
True if all coordinates are interpolated, false otherwise.
The name of the module, derived from the class name
The outer element of the custom cursor. This is the visual element that represents the cursor on screen.
Classname prefix for styling elements.
Current properties. Do not mutate these directly, use updateProps
instead.
Target coordinates of the cursor (without smooth interpolation).
Protected
_addAdds a class name on an element, and keeps track of it for removal when the module is destroyed.
The target DOM element.
The class name to toggle.
Protected
_calculateRecalculates current coordinates.
Protected
_cnHelper function to generate classnames with the module's prefix.
The class names to generate.
A string of class names with the module's prefix applied.
Protected
_createCreates the custom cursor and appends it to the DOM.
Protected
_destroyInternal method to handle the destruction of the module. It removes all callbacks, destroys properties, and cleans up event listeners and class names.
Get default mutable properties
Get default static properties
Protected
_handleHandles mouse down events.
Protected
_handleHandles mouse enter events.
Protected
_handleHandles mouse leave events.
Protected
_handleHandles mouse move events.
Protected
_handleHandles mouse up events.
Protected
_handleHandles property mutations
Protected
_handleHandles window blur events.
Protected
_lerpPerforms linear interpolation.
The current value.
The target value.
The interpolated value.
Protected
_renderRenders the cursor elements.
Protected
_setSets up the various event listeners for the cursor, such as mouse movements and clicks.
Protected
_toggleEnables cursor animation.
Protected
_toggleEnable or disable a cursor type
Registers an element to interact with the cursor, enabling dynamic size and position changes based on hover effects.
The settings for the hovered element.
Optional
enterTimeout: number = 100The timeout before the hover effect is applied.
Returns a destructor
Destroys the module, cleaning up resources, callbacks, and event listeners.
Adds a custom callback to the module.
The event type to listen for (e.g., 'props', 'destroy').
The function to execute when the event is triggered.
Additional settings for the callback.
Adds a callback on the module's destruction.
The function to execute during destruction.
Renders the cursor.
A customizable custom cursor component with smooth animations and hover interactions. Supports dynamic appearance changes and enhanced user interaction.
Documentation