# react-rectangle-selection

> A rectangle selection tool

Latest version **1.0.4** (published 2019-01-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-rectangle-selection
pnpm add react-rectangle-selection
yarn add react-rectangle-selection
bun add react-rectangle-selection
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-01-12 |
| First published | 2019-01-10 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 17.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Rémi Gallego |
| Maintainers | remi.gallego |

## Links

- npm: https://www.npmjs.com/package/react-rectangle-selection
- Homepage: https://github.com/remigallego/react-rectangle-selection
- Issues: https://github.com/remigallego/react-rectangle-selection/issues
- npm.io page: https://npm.io/package/react-rectangle-selection

## Dependencies (2)

- [react](https://npm.io/package/react.md) ^16.7.0
- [webpack](https://npm.io/package/webpack.md) ^4.28.4

## Recent versions

- 1.0.4 (latest) — 2019-01-12
- 1.0.3 — 2019-01-12
- 1.0.2 — 2019-01-12
- 1.0.1 — 2019-01-10
- 1.0.0 — 2019-01-10

## README

# React Rectangle Selection

<center><img src="https://media.giphy.com/media/TgMQsGWU3JirveHc1t/giphy.gif" width="500" /></center>

## Installation

`npm install --save react-rectangle-selection`

## How To Use

First import this component where you want to use it

`import RectangleSelection from "react-rectangle-selection"`

Then wrap it around the component that will trigger the selection box.

```jsx
render() {
  return(
    <RectangleSelection
      onSelect={(e, coords) => {
       this.setState({
          origin: coords.origin,
          target: coords.target
       });
      }}
      style={{
        backgroundColor: "rgba(0,0,255,0.4)",
        borderColor: "blue"
      }}
     >
      <div className="App" />
  </RectangleSelection>
  )
}
```

## Props

| _Prop_      |                        _Description_                        |
| ----------- | :---------------------------------------------------------: |
| onSelect    | Accepts a function that returns the coordinates of the page |
| onMouseUp   |                     Returns on mouse up                     |
| onMouseDown |                    Returns on mouse down                    |
| style       |          Sets the style of the selection rectangle          |
| disabled    |                    Disable the selection                    |

## Demo

<a href="http://five-food.surge.sh">RectangleSelection Demo</a>

---
_Source: https://npm.io/package/react-rectangle-selection · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
