@mentor-apm/react-sortable-tree
Version:
Drag-and-drop sortable component for nested data and hierarchies
18 lines (15 loc) • 498 B
JavaScript
import React, { useState } from 'react'
import SortableTree from '../src'
// In your own app, you would need to use import styles once in the app
// import 'react-sortable-tree/styles.css';
export const BarebonesExample = () => {
const [treeData, setTreeData] = useState([{ title: 'Chicken', expanded: true, children: [{ title: 'Egg' }] }]);
return (
<div style={{ height: 300 }}>
<SortableTree
treeData={treeData}
onChange={setTreeData}
/>
</div>
)
}