New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

treeboxjs

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

treeboxjs

Display and navigate hierarchical views

  • 1.0.3
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source
npm  David  npm bundle size

treebox

See a live example on CodePen

Install

npm i treeboxjs

Import

External JS with NPM:

  import TreeBox from 'treeboxjs';

  ...

ES6 module:

  <script type="module">
    import TreeBox from 'path-to-module/dist/index.browser.js';
    
    ...

Use

import TreeBox from 'treeboxjs';

const nodes = {
  display: `<h1>treebox example</h1>`, // This will display by default when treebox is rendered
  children: {
    directory: {
      children: {
        file: {
          display: `<p>A file</p>`,
        },
      },
    },
    file: {
      display: `
        <div>
          <p>Another file</p>
          <p>Multiple elements must be wrapped in a single enclosing element</p>
          <a treebox-href="/directory/file">Link to /directory/file within treebox</a>
        </div>
      `,
    },
  },
};

const root = document.getElementById('myTreeBoxRoot');

const tb = new TreeBox({nodes, root}); // Initiate treebox and append it to the "root" element

tb.navigate('/file'); // This code will cause treebox to render the `display` HTML at `nodes.children.file`
tb.navigate('/directory/file'); // This code will cause treebox to render the `display` HTML at `nodes.children.directory.children.file`
tb.navigate('/'); // This code will cause treebox to render the `display` HTML at `nodes.children`

FAQs

Package last updated on 10 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc