@saber2pr/rc-tree
TypeScript icon, indicating that this package has built-in type declarations

0.1.17 • Public • Published

@saber2pr/rc-tree

a tree-select renderer for react.

yarn add @saber2pr/rc-tree

What

example>>

import Tree from "@saber2pr/rc-tree";

const tree = {
  path: "root",
  name: "root",
  children: [
    {
      path: "root/node",
      name: "node",
      children: [
        {
          path: "root/node/node.md",
          name: "node",
          text: "node\n"
        }
      ]
    }
  ]
};

const App = () => (
  <Tree from={tree} map={node => <a href={node.path}>{node.name}</a>} />
);

ReactDOM.render(<App />, document.getElementById("root"));

// map depth
const TreeSelect = (
  <Tree
    from={tree}
    map={(node, depth) => (
      <a style={{ color: depth > 1 ? "red" : "green" }}>{node.name}</a>
    )}
  />
);

dev

yarn install

yarn run dev

yarn run build

Author

saber2pr

/@saber2pr/rc-tree/

    Package Sidebar

    Install

    npm i @saber2pr/rc-tree

    Weekly Downloads

    7

    Version

    0.1.17

    License

    none

    Unpacked Size

    9.42 kB

    Total Files

    22

    Last publish

    Collaborators

    • saber2pr