npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@linewlarsen/ngx-treeview

v22.0.0

Published

An Angular Bootstrap treeview component with checkboxes (Angular 22 fork of @charmedme/ngx-treeview)

Downloads

74

Readme

ngx-treeview

An Angular Bootstrap treeview component with checkboxes

This is a fork of @charmedme/ngx-treeview (originally leovo2708/ngx-treeview), upgraded to Angular 22 and published as @linewlarsen/ngx-treeview. For Angular 21, use @charmedme/ngx-treeview@3.

Dependencies

For Bootstrap 4, use @charmedme/[email protected]

You can customize CSS yourself to break down dependencies to Bootstrap.

Compatibility

| @linewlarsen/ngx-treeview | Angular | Bootstrap | Node.js | |---|---|---|---| | 22.x | ^22.0.0 | ^5.0.0 | 22.22+ or 24.13+ |

Features

  • Unlimited tree level
  • State: disabled / collapse, expand
  • Filtering
  • Internationalization (i18n) support
  • Template
  • Checkbox with tri-state

Status

NPM Version

Demo

The API is unchanged from the upstream package, so the upstream demo applies: https://charmedme.github.io/ngx-treeview/

Installation

After installing the above dependencies, install ngx-treeview via:

npm i @linewlarsen/ngx-treeview --save

NgModule-based applications

import { TreeviewModule } from '@linewlarsen/ngx-treeview';

@NgModule({
  declarations: [AppComponent, ...],
  imports: [TreeviewModule.forRoot(), ...],
  bootstrap: [AppComponent]
})
export class AppModule {
}

Standalone applications

Register the providers once when bootstrapping:

import { importProvidersFrom } from '@angular/core';
import { TreeviewModule } from '@linewlarsen/ngx-treeview';

bootstrapApplication(AppComponent, {
  providers: [importProvidersFrom(TreeviewModule.forRoot())]
});

Then import TreeviewModule in the components that use it:

@Component({
  imports: [TreeviewModule],
  ...
})
export class MyComponent {}

Migrating from @charmedme/ngx-treeview

Replace the package and update the import paths. No other code changes are needed.

npm uninstall @charmedme/ngx-treeview
npm i @linewlarsen/ngx-treeview
- import { TreeviewModule, TreeviewItem } from '@charmedme/ngx-treeview';
+ import { TreeviewModule, TreeviewItem } from '@linewlarsen/ngx-treeview';

Usage

Treeview:

<ngx-treeview
  [config]="config"
  [items]="items"
  (selectedChange)="onSelectedChange($event)"
  (filterChange)="onFilterChange($event)"
>
</ngx-treeview>

Treeview with dropdown:

<ngx-dropdown-treeview
  [buttonClass]="buttonClass"
  [config]="config"
  [items]="items"
  (selectedChange)="onSelectedChange($event)"
  (filterChange)="onFilterChange($event)"
>
</ngx-dropdown-treeview>

config is optional. This is the default configuration:

{
   hasAllCheckBox: true,
   hasFilter: false,
   hasCollapseExpand: false,
   decoupleChildFromParent: false,
   maxHeight: 500
}

You can change default configuration easily because TreeviewConfig is injectable.

Pipe ngxTreeview:

To map your JSON objects to TreeItem objects.

<ngx-dropdown-treeview
  [config]="config"
  [items]="items | ngxTreeview:'textField'"
  (selectedChange)="onSelectedChange($event)"
>
</ngx-dropdown-treeview>

Create a TreeviewItem:

const itCategory = new TreeviewItem(
{
  text: "Software",
  value: 9,
  children: [
    {
      text: "Programming",
      value: 91,
      children: [
        {
          text: "Frontend",
          value: 911,
          children: [
            { text: "Angular 20", value: 9114 },
            { text: "Angular 21", value: 9115 },
            { text: "Angular 22", value: 9116, disabled: true },
            { text: "ReactJS", value: 9120 },
          ],
        },
        {
          text: "Backend",
          value: 912,
          children: [
            { text: "C#", value: 9121 },
            { text: "Java", value: 9122 },
            { text: "Python", value: 9123, checked: false },
          ],
        },
      ],
    },
  ],
},
{
  text: "Networking",
  value: 92,
  children: [
    { text: "Internet", value: 921 },
    { text: "Security", value: 922 },
    { text: "Switches", value: 923 },
  ],
});

You can pass the second parameter 'autoCorrectChecked' with value=true (default is false) in constructor of TreeviewItem to correct checked value of it and all of its descendants. In some cases, you need to push or pop children flexibly, checked of parent may be not correct. Then you need to call function correctChecked() to help to correct from root to its descendants.

const vegetableCategory = new TreeviewItem({
  text: "Vegetable",
  value: 2,
  children: [
    { text: "Salad", value: 21 },
    { text: "Potato", value: 22 },
  ],
});
vegetableCategory.children.push(
  new TreeviewItem({ text: "Mushroom", value: 23, checked: false })
);
vegetableCategory.correctChecked(); // need this to make 'Vegetable' node to change checked value from true to false

TreeviewEventParser:

Extract data from list of checked TreeviewItem and send it in parameter of event selectedChange. Some built-in TreeviewEventParser:

  • DefaultTreeviewEventParser: return values of checked items.
  • DownlineTreeviewEventParser: return list of checked items in original order with their ancestors.
  • OrderDownlineTreeviewEventParser: return list of checked items in checked order with their ancestors. Note that: value of a leaf must be different from value of other leaves.

Templating:

See example 4 & 5 in the demo.

Contributing

Ideas, proposals and bug reports are welcome as GitHub issues. Changes that are useful upstream are also offered to charmedme/ngx-treeview.