Skip to content

gshohat/web-component-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Web Component Tree

NPM License

Lightweight component for displaying hierarchical data < 20k 😎
Compatible with React, Vue, Angular & other frameworks. Emits selections to parent component

web-component-tree

Vue Usage

npm i web-component-tree

<script setup>
import TreeSelect from 'web-component-tree';

const items = [
  { groupLabel: 'Frontend Developer',
    children: [
      {groupLabel: 'Vue',
        children: [ { label:'Options Api', value: 'optionsApi'},
          { label: 'Composition Api', value: 'compositionApi' }]},
      { label: 'React', value: 'react'},
      { label: 'Angular', value: 'angular'}
    ]},
  { groupLabel: 'Backend Developer',
    children: [
      {label: 'Bun', value: 'bun' },
      { label: 'Deno', value: 'deno' },
      { label:'Node', value: 'node' }
    ]},
];

onMounted(() => {
  const treeElement = document.querySelector('#tree-select');
  treeElement.items = items;

  treeElement.selectionsChanged = (selections) => {
    console.log(selections);
  }

</script>


<template>
<tree-select id="tree-select"/>
</template>

vite config

export default defineConfig({
  plugins: [
    vue({
      template: {
        compilerOptions: {
          isCustomElement: (tag) => tag.includes('tree-select')
        }
      }
    })
  ],

Contact

Feel free to ping me 💫
connect@giladshohat.com

giladshohat.com

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published