# @terguevarra/react-bootstrap-treeview

> ## Installation

Latest version **0.0.18** (published 2021-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @terguevarra/react-bootstrap-treeview
pnpm add @terguevarra/react-bootstrap-treeview
yarn add @terguevarra/react-bootstrap-treeview
bun add @terguevarra/react-bootstrap-treeview
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.18 |
| Published | 2021-04-21 |
| First published | 2021-04-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 20.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ruther John Guevarra |
| Maintainers | terguevarra |
| Keywords | react, bootstrap, treeview, bootstrap-treeview, react-bootstrap-treeview |

## Links

- npm: https://www.npmjs.com/package/@terguevarra/react-bootstrap-treeview
- Repository: https://github.com/terguevarra/react-bootstrap-treeview
- Homepage: https://github.com/terguevarra/react-bootstrap-treeview#readme
- Issues: https://github.com/terguevarra/react-bootstrap-treeview/issues
- npm.io page: https://npm.io/package/@terguevarra/react-bootstrap-treeview

## Dependencies (3)

- [clsx](https://npm.io/package/clsx.md) ^1.1.1
- [react-jss](https://npm.io/package/react-jss.md) ^10.6.0
- [prop-types](https://npm.io/package/prop-types.md) ^15.7.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.18 (latest) — 2021-04-21
- 0.0.17 — 2021-04-19
- 0.0.16 — 2021-04-19
- 0.0.15 — 2021-04-19
- 0.0.14 — 2021-04-15
- 0.0.13 — 2021-04-15
- 0.0.12 — 2021-04-15
- 0.0.11 — 2021-04-14
- 0.0.10 — 2021-04-14
- 0.0.9 — 2021-04-14
- 0.0.8 — 2021-04-14
- 0.0.7 — 2021-04-14
- 0.0.6 — 2021-04-14
- 0.0.5 — 2021-04-14
- 0.0.4 — 2021-04-14
- … 3 more at https://npm.io/package/@terguevarra/react-bootstrap-treeview/versions

## README

# React Bootstrap Treeview

## Installation

1. Install Package
``` Javascript
npm install --save @terguevarra/react-bootstrap-treeview
```
2. Include [Bootstrap 5](https://getbootstrap.com/) and [Bootstrap Icons](https://icons.getbootstrap.com/)

Via CDN:

``` HTML
<link   href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta3/dist/css/bootstrap.min.css" 
        rel="stylesheet" />

<link   href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.4.1/font/bootstrap-icons.css"
        rel="stylesheet" />
```

or

Import [Bootstrap 5](https://getbootstrap.com/) and [Bootstrap Icons](https://icons.getbootstrap.com/):
``` Javascript
npm install bootstrap@next bootstrap-icons
```



## Usage

```Javascript
import React, { useState } from 'react';
import ReactBootstrapTreeview from '@terguevarra/react-bootstrap-treeview';

const sampleData = [
  {
    "id": 1,
    "parentId": 0,
    "label": "Lorem Ipsum"
  },
  {
    "id": 2,
    "parentId": 0,
    "label": "Lorem Ipsum"
  },
  {
    "id": 3,
    "parentId": 1,
    "label": "Lorem Ipsum"
  },
  {
    "id": 4,
    "parentId": 2,
    "label": "Lorem Ipsum"
  },
  {
    "id": 5,
    "parentId": 3,
    "label": "Lorem Ipsum"
  }
]

function App(){
    const [data, setData] = useState(sampleData);

    return(
        <>
            <ReactBootstrapTreeview list={data}
                                    idName="id"
                                    parentIdName="parentId"
                                    label={rowData => `${rowData.id} - ${rowData.label}`} />
        </>
    );
}

export default App;
```

## Main Props
|Name|Type|Default Value|Required|Description|
|----|-----|-----|-----|-----------|
|list|Array|-|Yes|Data to be rendered|
|idName|String|-|Yes|Property name of unique identification|
|parentIdName|String|-|Yes|Property name of Parent Id|
|label|String or Function|-|Yes|Property to be rendered|
|tableClassName|String|table|No|Bootstrap Table class you want to use for the treeview|
|actions|Array|-|No|Actions list. You can add buttons to rows.|



## actions
|Name|Type|Default Value|Required|Description|
|----|-----|-----|-----|-----------|
|icon|String|-|Yes|Bootstrap Icon class _(eg. `bi bi-plus`)_|
|onClick|Function|-|Yes|This will trigger the function on button click. _(Parameters: `event`, `rowData`)_|
|buttonClass|String|btn|No|Bootstrap button class _(eg. `btn btn-primary`)_|
|disabled|bool|false|No|Button is enabled or disabled|
|hidden|bool|false|No|Button is visible or not|

---
_Source: https://npm.io/package/@terguevarra/react-bootstrap-treeview · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
