@stoplight/tree-list
v6.1.0
Published
A React component that renders a file tree like interface.
Downloads
1,095
Readme
@stoplight/tree-list
- View the changelog: Releases
- Features
- Installation
- Usage
- TreeList Props
- TreeList Store
- TreeList Tree
- Contributing
Features
- Component for rendering a tree in a tree like interface
- Drag and drop support
- Context menu support
- Themeable
Installation
Supported in modern browsers.
# latest stable
yarn add @stoplight/tree-list @stoplight/ui-kit
Usage
This is a bare minimum required to have anything rendered.
import { TreeList, TreeStore, Tree } from '@stoplight/tree-list';
import '~@stoplight/tree-list/styles/_tree-list.scss';
const root = Tree.createArtificialRoot();
root.children.push(
{
id: generateRandomId(),
name: 'foo',
parent: root,
children: [],
},
{
id: generateRandomId(),
name: 'bar',
parent: root,
},
{
id: generateRandomId(),
name: 'baz',
parent: root,
children: [],
},
);
const store = new TreeStore(new Tree({}, root), new TreeState());
<TreeList store={store} />;
You will also need to make sure the stylesheet is loaded.
@import '~@stoplight/tree-list/styles/tree-list';
Contributing
- Clone repo.
- Create / checkout
feature/{name}
,chore/{name}
, orfix/{name}
branch. - Install deps:
yarn
. - Make your changes.
- Run tests:
yarn test.prod
. - Stage relevant files to git.
- Commit:
yarn commit
. NOTE: Commits that don't follow the conventional format will be rejected.yarn commit
creates this format for you, or you can put it together manually and then do a regulargit commit
. - Push:
git push
. - Open PR targeting the
master
branch.