scrollable-drag-n-drop
v1.1.0
Published
drag n drop within a scrollable panel
Downloads
3
Readme
ScrollableDragNDrop
This is a versatile React.js based package for drag and drop inside of a scrollable container. This package ...
- makes user defined elements draggable
- allows the user to create draggable elements inside of an optionally scrollable container
- makes it so that dragged elements cannot be draggged outside of their container
#API and usage
install:
npm install --save scrollable-drag-n-drop
import:
import ScrollableContainer from 'scrollable-drag-n-drop';
This package makes the ScrollableContainer
element available to the user. This is all you need to make your elements draggable.
PropTypes
elements
- required, an array of renderable elements. These are the elements you wish to make draggablecontainerStyle
- required, an object with aleft
,width
andheight
property. Values must be numbersnoDragStyle
- required, must have awidth
property with a number valuedragStyle
- required, must have awidth
property with a number valuehandleStyle
- must have awidth
property with a number valueinnerPanelStyle
- style object for placing the draggable elements inside of the scrollable container. By default, elements are at 0, 0 inside ofScrollableContainer
elementMargin
- the margin between draggable elements, defaults to 0scrollableContainerShouldUpdate
- optional user provided function to be executed when the React.jsshouldComponentUpdate
lifecycle hook executesshowHandle
- flag indicating whether draggable elements should only be draggable by a handle, defaults to false