1.0.5 • Published 6 years ago

react-drag-picker v1.0.5

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

react-drag-picker

drag select element by react.

npm NPM downloads

example

npm.io

install

npm i react-drag-picker --save

using

import DragPicker from 'react-drag-picker';

const styles = {position: 'relative'};

<div style={styles}>
  <DragPicker>
    <div key="1">1</div>
    <div key="2">2</div>
    <div key="3">3</div>
  </DragPicker>
</div>

props

props nametypedescriptiondefaultisRequired
onChangefunctionreturn selected item key values() => {}true
selectedStyleObjectselected style{backgroundColor: '#64B5F6', color: 'white'}false
classNamestringparent dom(div) class name''false
selectionBoxStyleObjectselected box style{background: 'rgba(0, 162, 255, 0.4)', position: 'absolute', zIndex: 100000}false
enabledbooleancan enabledtruefalse
idstringparent dom idselectionBoxfalse
disabledkeysarraydon't allow to select items key. eg: '11', '17'[]false
disabledClassstringdisabled item's class name''false
maxLengthnumberselected max number, 0 is no limited0false
skipDisabledbooleanSkips disabled items whether to continue selecting itemsfalsefalse

function

function namedescriptionparams
clearAllclear selected item, by refs callback

example

import DragPicker from 'react-drag-picker';

const styles = {position: 'relative'};

<div style={styles}>
  <DragPicker>
    {
      Array.from({length: 10}, (v, k) => k).map(i => <div className={'select-box'} key={i}>{i + 1 }</div>)
    }
  </DragPicker>
</div>
.select-box {
  background: #f0f0f0;
  width: 30px;
  height: 120px;
  text-align: center;
  line-height: 104px;
  display: inline-block;
  font-size: 14px;
  color: #5A5A5A;
  box-sizing: border-box;
  border: 1px solid #5A5A5A;
}

Project form react-drag-select

1.0.5

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago