react-treeview-ui
Version:
A lightweight, flexible, and accessible Treeview component for React
41 lines (29 loc) • 1.54 kB
Markdown
# 🌳 React Treeview Component
A lightweight, flexible, and accessible **Treeview component for React**.
Supports nested nodes, checkboxes with indeterminate state, icons, and customizable rendering.
---
## ✨ Features
- Recursive rendering for unlimited nesting
- Checkbox support with indeterminate state
- Customizable icons and styling
- TypeScript support out of the box
---
## 📦 Installation
```bash
npm install react-treeview-ui
# or
yarn add react-treeview-ui
```
| Prop | Type | Default | Description |
|-------------|-----------------------------|--------------|---------------------------------------------------------------|
| `data` | `Array<NodeData>` | **required** | Tree data (see [Data Structure](#-data-structure)). |
| `value` | `string[]` | `[]` | Selected node values. |
| `onChange` | `(value: string[]) => void` | - | Callback fired when selection changes. |
| `onlyRead` | `boolean` | `false` | Makes the tree read-only. |
| `withIcons` | `boolean` | `false` | Show icons next to nodes. |
## 🎨 Styles
This package ships with a bundled stylesheet.
You need to import it manually in your app entry point:
```bash
import "react-treeview-ui/dist/index.css";
```