JSPM

  • Created
  • Published
  • Downloads 43271
  • Score
    100M100P100Q159265F
  • License MIT

A React component that decorates its children with mouse cursor coordinates, plotted relative to itself.

Package Exports

  • react-cursor-position

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (react-cursor-position) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

react-cursor-position

A React component that decorates its children with mouse cursor coordinates, plotted relative to itself.

Installation

npm install --save react-cursor-position

Usage

Intended as a primitive for composing features that require notification of mouse cursor position status.

<ReactCursorPosition>
    <ChildComponentOne/>
    <ChildComponentTwo/>
</ReactCursorPosition>

ReactCursorPosition wraps its children in a div, which mouse cursor position is plotted relative to.

Each child component will receive a prop named cursorPosition, which has the following structure.

{
    x: [Number],
    y: [Number]
}

props API

className : String - Optionally provide a CSS class to be applied to the div rendered by react-cursor-position.

onCursorPositionChanged : Function - Optionally provide a function that will be called when the mouse cursor position changes. Function will receive cursorPosition object as parameter.

shouldDecorateChildren : Boolean - Defaults to true. Optionally suppress cursorPosition decoration of child components by setting this prop false.

Support

Please open an issue.

Development

git clone https://github.com/ethanselzer/react-cursor-position.git

See available commands:

npm run

Contributing

Please contribute using Github Flow. Create a branch, add commits, and open a pull request.