Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

tree-ngx

inspirsea9.4kMIT4.3.0TypeScript support: included

A highly customizable Angular Tree Component, usable with minimal implementation.

ngx, tree component, ngx tree, tree-ngx, tree ngx, ng tree component, ng, angular, ng2, angular2, tree, treeview, angular2-tree, angular-tree, angular tree, angular2 tree, ng2-tree, ng2tree, ng2 tree, ngtree, ng-tree

readme

npm version license

tree-ngx

Introduction

Tree-ngx is a treeview component that can easily handle thousands of nodes. It's made to be used with minimal implementation as well as being highly customizable. Made with flexbox, and the default style is easy to override.

If you find a bug or have a feature request please open a Github issue.

Supports

Selection

Tri-state checkboxes

Filtering

Custom Templates

Custom Styling

Callbacks

Documentation

View the full documentation at http://emilsunesson.com/docs/tree-ngx/tree-ngx-intro

Demo

Live demo can be found in the documentation http://emilsunesson.com/docs/tree-ngx/tree-ngx-intro

Installation

$> npm install tree-ngx --save

Include default style

@import 'tree-ngx';

Include module

import { TreeNgxModule } from 'tree-ngx';

@NgModule({
  imports: [TreeNgxModule]
}

Example

How it looks with some minor style customization. See the working example at http://emilsunesson.com/docs/tree-ngx/tree-ngx-example.

Template

Basic template implementation.

<tree-ngx [nodeItems]="nodeItems"> </tree-ngx>

Data

this.nodeItems = [{
    id: '0',
    name: 'Heros',
    children: [
      {
        id: '1',
        name: 'Batman',
        item: {
          phrase: 'I am the batman'
        }
      },
      {
        id: '2',
        name: 'Superman',
        item: {
          phrase: 'Man of steel'
        }
      }
    ]
  },
  {
    id: '3',
    name: 'Villains',
    children: [
      {
        id: '4',
        name: 'Joker',
        item: {
          phrase: 'Why so serius'
        }
      },
      {
        id: '5',
        name: 'Lex luthor',
        item: {
          phrase: 'I am the villain of this story'
        }
      }
    ]
  }];

changelog

[4.3.0] (2022-02-16)

  • Rewrote the build pipeline and removed dependencies

[4.2.0] (2022-02-16)

  • All build dependencies updated
  • Tested with angular 13.

[4.1.0] (2021-08-23)

  • Tested with angular 12.

[4.0.0] (2020-05-23)

  • Tested with angular 9.
  • Changed name of method toggleById to selectById

[3.1.0] (2019-10-13)

  • Added toggleById.
  • Added collapseById.

[3.0.0] (2019-08-01)

  • Tested with angular 8.
  • Breaking changes.
  • Empty children array now counts as leaf.
  • SingleSelect now emits its item even if the selected node is not a leaf.
  • Bugfixes.
  • Added disable and removed the implicit disable functionality IE (if a node had no children it was disabled).
  • Added css class for disabled node to enabled override.
  • Added new api methods.

[2.2.2] (2019-05-01)

  • Updated dependencies and tested with newer versions of angular.

[2.1.0] (2018-09-23)

  • Added api to edit node name and node item.

[2.0.0] (2018-09-05)

  • Update to angular 6