drag-react
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

React Draggable Component

A simple and lightweight component for making elements draggable.

Demo

stackblitz

Installation

$ npm install drag-react
# yarn add drag-react

Example

import { Draggable } from 'drag-react';

<Draggable>
  <div>My element is draggable now</div>
</Draggable>

Props

name type default description
children any - Some element
className? string 'drag-react' Class name for drag wrapper
style? Object { position: 'fixed', left: '10px', top: '10px', zIndex: 99999 , cursor: 'move' } css style for drag wrapper
onDragStart? (_: DOMRect) => void - Called whenever the user mouses down
onDragEnd? (_: DOMRect) => void - Called when dragging stops

License

MIT

Package Sidebar

Install

npm i drag-react

Weekly Downloads

214

Version

1.1.1

License

MIT

Unpacked Size

7.8 kB

Total Files

7

Last publish

Collaborators

  • haikel