Giter VIP home page Giter VIP logo

svelte-treeview's Introduction

what is this

A Svelte collapsable treeview with custom components added to nodes. Tree state is persistant trough the usage of indexeddb/localstorage

example

https://stroblp.github.io/svelte-treeview/

https://stroblp.github.io/gh-pages-demo-app/#/building-floors/

install

npm i @stroblp/svelte-treeview

Usage..

TreeItem.svelte,NodeItem.svelte,TreeRoot.svelte can be any valid svelte component

<script>
	import Tree from "svelte-treeview";
    import Item from "./TreeItem.svelte"
    import Node from "./TreeNode.svelte"
    import Root from "./TreeRoot.svelte"
    const tree =
    {
        props: { id: "root-node", label: "root" }, children: [
            {
                props: { id: "node1", label: "node1" }, children: [
                    { props: { id: "item1-1", label: "item1.1" } },
                    { props: { id: "item1-2", label: "item1.2"} },
                    {
                        props: { id: "node11", label: "node1" }, children: [
                            { props: { id: "item11-1", label: "item11.1"} },
                            { props: { id: "item11-2", label: "item11.2" } },
                        ]
                    },
                ]
            },
            {
                props: { id: "node2", label: "node2" }, children: [
                    { props: { id: "item2-1", label: "item2.1"} },
                    { props: { id: "item2-2", label: "item2.2" } },
                ]
            }
        ]
    }    
</script>



<Tree node={tree} treeName="test-tree" />

svelte-treeview's People

Contributors

stroblp avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.