React component for "rectangle selection"

- 1 answer

Ad

There is a common UI gesture, used in Windows Explorer for example, where you click and hold, drag, then release, and objects falling in the rectangle with the top left corner defined by where you clicked and the bottom right corner defined by where you released are selected. In GIMP, the tool for this looks like this.

enter image description here

Another example is here: http://jointjs.com/rappid/docs/ui/selectionView

I know how to implement this is in javascript as a react component, but this is so common that I was sure someone already did, but I can't find any react component that does this no matter how hard I search. Is "rectangle selection" the wrong name?

Ad

Answer

Ad

I have provided a solution in the comment, but I will post it here again as a reference for anyone who have the same need in the future.

react-selectable

Allows individual or group selection of items using the mouse. Click and drag to las/p>

react-selectable

Allows individual or group selection of items using the mouse. Click and drag to lasso multiple items, hold the cmd/ctrl key to select non-adjacent items.

Ad
source: stackoverflow.com
Ad