react-sortable-tree-mui-theme-3
v0.0.2
Published
Material UI theme set-3 for react-sortable-tree
Downloads
88
Readme
React Sortable Tree Material-UI Theme
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>
);
}
}