@path-tree/react
v0.3.2
Published
Provides components with a hierarchical structure.
Downloads
2
Maintainers
Readme
@path-tree/react
Usage
Install
yarn add @path-tree/react tslib
Basic Usage
import * as React from "react";
import * as ReactDOM from "react-dom";
import * as PathTree from "@path-tree/react";
const props: PathTree.Props = {
pathItems: [
{
type: "file",
path: "a/b/index.js",
},
{
type: "file",
path: "a/b/c/index.js",
},
],
};
ReactDOM.render(<PathTree.Component {...props} />, document.querySelector("#root"));
Define components
import * as PathTree from "@path-tree/react";
const props: PathTree.Props = {
FileComponent: (fileProps) => {
return <p>{fileProps.path}</p>;
},
DirectoryComponent: (directoryProps) => {
return <div>{directoryProps.children}</div>;
},
pathItems: [
{
type: "file",
path: "a/b/index.js",
},
{
type: "file",
path: "a/b/c/index.js",
},
],
};
LICENSE
@path-tree/react
is MIT licensed.