0.1.5 • Published 4 years ago

react-sortable-tree-mui-theme-1 v0.1.5

Weekly downloads
7
License
MIT
Repository
-
Last release
4 years ago

React Sortable Tree Material-UI Theme

theme appearance

Features

  • You can click anywhere on a node to drag it.
  • More compact design, with indentation alone used to represent tree depth.

Usage

npm install --save react-sortable-tree-mui-theme-1
import React, { Component } from 'react';
import SortableTree from 'react-sortable-tree';
import MaterialTheme from 'react-sortable-tree-mui-theme-1';

export default class Tree extends Component {
  constructor(props) {
    super(props);

    this.state = {
      treeData: [ { children: [ { title: 'Box' } ], expanded: true, title: 'Layout' } ]
    };
  }

  render() {
    return (
      <div style={{ height: 400, overflowX: 'hidden', overflowY: 'auto' }}>
        <SortableTree
          generateNodeProps={
            rowInfo => ({
              buttons: (
                <i className='material-icons' style={{ fontSize: 18 }}>
                  more_vert
                </i>
              ),
              icons: (
                <i className='material-icons' style={{ fontSize: 18 }}>
                  drag_indicator
                </i>
              ),
              title: (
                <Fragment>
                  <i className='material-icons' style={{ color: '#1890FF', fontSize: 18, marginRight: 6 }}>link</i>
                  <span>{rowInfo.node.title}</span>
                </Fragment>
              )
            })
          }
          isVirtualized={false}
          treeData={this.state.treeData}
          onChange={treeData => this.setState({ treeData })}
          theme={MaterialTheme}
        />
      </div>
    );
  }
}
0.1.5

4 years ago

0.1.4

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago

0.0.9

4 years ago

0.0.8

4 years ago

0.0.7

4 years ago

0.0.6

4 years ago

0.0.5

4 years ago

0.0.4

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago