cb-treeview
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

Coolbrains Treeview Web Component - Built With Stenciljs

This is a TreeView Web Component using Stenciljs.

  • Built with Stencil
  • Built with TailwindCSS v3.x

*** Special thanks to Hasibul Haque

Installation

npm install cb-treeview

Or use npm cdn

<script type="module" src="https://cdn.jsdelivr.net/npm/cb-treeview@0.0.3/dist/cb-treeview/cb-treeview.esm.js"></script>

Usage

The Coolbrains TreeView Component can be use as following:

<cb-treeview></cb-treeview>
<script>
const data = [
        {
          id: 1,
          name: 'Parent 1',
          parentId: null,
          children: [
            {
              id: 3,
              name: 'Parent 1-0',
              parentId: 1,
              children: [
                {
                  id: 2,
                  name: 'Leaf',
                  parentId: 3,
                  children: [
                    {
                      id: 8,
                      name: 'Leaf',
                      parentId: 2,
                      children: [],
                    },
                  ],
                },
              ],
            },
            {
              id: 4,
              name: 'Parent 1-1',
              parentId: 1,
              children: [],
            },
          ],
        },
        {
          id: 5,
          name: 'Parent 2',
          parentId: null,
          children: [],
        },
        {
          id: 9,
          name: 'Parent 3',
          parentId: null,
          children: [
            {
              id: 4,
              name: 'Parent 3-0',
              parentId: 9,
              children: [],
            },
            {
              id: 4,
              name: 'Parent 3-1',
              parentId: 9,
              children: [],
            },
          ],
        },
      ];
const cbTreeView = document.querySelector('cb-treeview');
cbTreeView.dataSource = data;
</script>

hide checkbox:

<cb-treeview check-box="false"></cb-treeview>

Demo

codesandbox

Readme

Keywords

none

Package Sidebar

Install

npm i cb-treeview

Weekly Downloads

16

Version

1.0.0

License

MIT

Unpacked Size

1.51 MB

Total Files

70

Last publish

Collaborators

  • nazmulpro