react-sortable-tree-node

1.3.0 • Public • Published

react-sortable-tree-node

react-sortable-tree-node

NPM JavaScript Style Guide

Install

npm install --save react-sortable-tree-node

Demo

Demo and playground are available here

Versions

CHANGELOG

Usage Example

import React from 'react';
import ReactSortableTreeNode from 'react-sortable-tree-node';

const data = [
  {
    id: 'item-0',
    title: 'item 0',
    dropDisabled: true,
    dragDisabled: true
  },
  {
    id: 'item-1',
    title: ({ node, path, treeIndex }) => {
      return `item 1 - treeIndex ${treeIndex}`
    }
  },
  {
    id: 'item-2',
    title: 'item 2',
    expanded: true,
    isDirectory: true,
    children: [
      {
        id: 'item-20',
        title: 'item 20'
      }
    ],
  },
];

const [treeData, onChange] = React.useState(data);
<ReactSortableTreeNode treeData={treeData} onChange={onChange} />

Develop

In the project directory, you can run:

npm install

npm start

Runs the app in the development mode.
Open http://localhost:6006 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

License

MIT © bonnv79

Dependents (0)

Package Sidebar

Install

npm i react-sortable-tree-node

Weekly Downloads

5

Version

1.3.0

License

MIT

Unpacked Size

270 kB

Total Files

29

Last publish

Collaborators

  • ngovanbon16