1.1.0 • Published 9 years ago
scrollable-drag-n-drop v1.1.0
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-dropimport:
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,widthandheightproperty. Values must be numbersnoDragStyle- required, must have awidthproperty with a number valuedragStyle- required, must have awidthproperty with a number valuehandleStyle- must have awidthproperty with a number valueinnerPanelStyle- style object for placing the draggable elements inside of the scrollable container. By default, elements are at 0, 0 inside ofScrollableContainerelementMargin- the margin between draggable elements, defaults to 0scrollableContainerShouldUpdate- optional user provided function to be executed when the React.jsshouldComponentUpdatelifecycle hook executesshowHandle- flag indicating whether draggable elements should only be draggable by a handle, defaults to false