Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-smooth-draggable-list

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-smooth-draggable-list

smooth, mobile-friendly, draggable list for react.

  • 0.2.8
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
27
decreased by-18.18%
Maintainers
1
Weekly downloads
 
Created
Source

React Smooth Draggable List

smooth, mobile-friendly, draggable list component for react.

:star: Check out the Demo :star:

How to Use It

Install

This component can be installed with npm:

npm install react-smooth-draggable-list --save
Include
import List from 'react-smooth-draggable-list'
Examples
Simple Example:
const items = [1, 2, 3]
<List rowHeight={80}>{
  items.map(item => <List.Item>item {item}</List.Item>)
}</List>
Controlled Example:
class MyList extends React.Component {
  // order index starts at zero
  state = {order: [1, 0, 2]}

  render() {
    return (
      <List
        rowHeight={50}
        order={this.state.order}
        onReOrder={order => this.setState({order})}
      >
        <List.Item>item 1</List.Item>
        <List.Item>item 2</List.Item>
        <List.Item>item 3</List.Item>
      </List>
    )
  }
}
More:

You can find more examples in the demo source code.

Props
List:
NameTypeDefaultDescription
orderarraynullorder is optional - when it is not defined, the list will be uncontrolled.
onReOrder(order) => {}nullThe onReOrder callback is invoked every time a user changes the list order. order is a list of integers representing the order of items.
rowHeightinteger0Required: RowHeight defines the height of each list item in pixels.
rowWidthintegernullRowWidth defines the width of the list component in pixels. Width defaults to 100% of parent.
gutternumbernullAmount of space between list items in pixels. Defaults to 0.1 * props.rowHeight.
springConfigobjectnullDrag animation control. Object has three keys. stiffness: optional, defaults to 300. damping: optional, defaults to 50. precision: optional, defaults to 0.05.
List.Item:
NameTypeDefaultDescription
dragHandleComponentnullPass in a functional component. See DragHandle in demo source code for an example.
disabledbooleanfalseAllows user to disable list items.

How to Contrubite

# install with dev dependencies
npm install react-smooth-draggable-list --save-dev
# run the dev server on port 2100
npm run dev

npm run dev will run a dev server with hot reloading enabled. The dev server runs at http://localhost:2100. Dev server source code is here.

Keywords

FAQs

Package last updated on 20 Jan 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc