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

shadcn-treeview

v0.1.0

Published

Accessible tree view component for React with Shadcn UI styling. Built on react-accessible-treeview.

Readme

shadcn-treeview

A lightweight, accessible, and customizable tree view component for React. Built on top of react-accessible-treeview with Shadcn UI styling.

License: MIT

Features

  • Accessible - Built on react-accessible-treeview with full keyboard navigation and ARIA support
  • Customizable - Flexible styling with Tailwind CSS classes
  • Lightweight - Minimal dependencies
  • TypeScript - Full TypeScript support with exported types
  • Inline Editing - Built-in support for renaming items
  • Multi-select - Support for single and multi-selection modes

Installation

Shadcn CLI (Recommended)

npx shadcn@latest add https://shadcn-treeview.achromatic.dev/registry/tree-view.json

Package Manager

npm install shadcn-treeview

Quick Start

1. Import the components

import { TreeView, TreeViewItem, flattenTree } from "shadcn-treeview";

2. Create your tree data

const data = flattenTree({
  name: "Project",
  children: [
    {
      name: "src",
      children: [
        { name: "components", children: [{ name: "tree-view.tsx" }] },
        { name: "app.tsx" },
        { name: "index.tsx" }
      ]
    },
    { name: "package.json" },
    { name: "README.md" }
  ]
});

3. Render the tree

<TreeView
  data={data}
  aria-label="File tree"
  className="w-64 rounded border p-2"
  nodeRenderer={({
    element,
    isBranch,
    isExpanded,
    isSelected,
    getNodeProps,
    level
  }) => (
    <TreeViewItem
      {...getNodeProps()}
      name={element.name}
      isBranch={isBranch}
      isExpanded={isExpanded}
      isSelected={isSelected}
      level={level}
      indentation={16}
      icon={isBranch ? <FolderIcon /> : <FileIcon />}
    />
  )}
/>

API Reference

TreeView

The main container component. Accepts all props from react-accessible-treeview.

| Prop | Type | Description | |------|------|-------------| | data | INode[] | Flattened tree data (use flattenTree helper) | | nodeRenderer | (props: INodeRendererProps) => ReactNode | Render function for each node | | multiSelect | boolean | Enable multi-selection | | togglableSelect | boolean | Allow toggling selection | | clickAction | "EXCLUSIVE_SELECT" \| "SELECT" \| "FOCUS" | Action on click |

TreeViewItem

The component for rendering individual tree items.

| Prop | Type | Default | Description | |------|------|---------|-------------| | name | string | Required | Display name of the item | | level | number | Required | Nesting level (1-based) | | isBranch | boolean | false | Whether item has children | | isExpanded | boolean | false | Whether item is expanded | | isSelected | boolean | false | Whether item is selected | | indentation | number | 16 | Base indentation in pixels | | levelIndentation | number | 48 | Indentation per level | | icon | ReactNode | - | Icon to display | | isEditing | boolean | false | Enable edit mode | | onEditSubmit | (value: string) => void | - | Edit submit callback | | isLoading | boolean | false | Show loading state | | expandIcon | ReactNode | - | Custom expand icon | | loadingIcon | ReactNode | - | Custom loading icon |

Examples

Multi-select

<TreeView
  data={data}
  multiSelect
  togglableSelect
  clickAction="EXCLUSIVE_SELECT"
  onSelect={(props) => console.log("Selected:", props)}
  nodeRenderer={/* ... */}
/>

With Context Menu

<ContextMenu>
  <ContextMenuTrigger asChild>
    <TreeViewItem {...props} />
  </ContextMenuTrigger>
  <ContextMenuContent>
    <ContextMenuItem>Rename</ContextMenuItem>
    <ContextMenuItem>Delete</ContextMenuItem>
  </ContextMenuContent>
</ContextMenu>

Inline Editing

<TreeViewItem
  name={element.name}
  isEditing={element.metadata?.isEditing}
  onEditSubmit={(newName) => {
    // Update tree data with new name
    updateNodeName(element.id, newName);
  }}
  {...otherProps}
/>

Documentation

For full documentation, visit shadcn-treeview.achromatic.dev.

License

MIT


Maintained by Achromatic