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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-multi-checkbox-tree

v0.1.0-beta

Published

React Checkbox Tree for Multiple Checks

Readme

react-multi-checkbox-tree

react-multi-checkbox-tree is a component for multiple checkboxes.

examples

Install

npm install -S react-multi-checkbox-tree

Tree Data

  • id - It is a unique numeric value.
  • name - The name of the checkbox.
  • parentId - It points to the parent's ID. If the value is 0, it is the root.
export const treeItem = [
  {
    id: 1,
    name: 'root1',
    parentId: 0,
  },
  {
    id: 2,
    name: 'item1',
    parentId: 1,
  },
  {
    id: 3,
    name: 'item2',
    parentId: 1,
  },
  {
    id: 4,
    name: 'item3',
    parentId: 2,
  },
  {
    id: 5,
    name: 'item4',
    parentId: 3,
  },
  {
    id: 6,
    name: 'item5',
    parentId: 4,
  },
  {
    id: 7,
    name: 'item6',
    parentId: 4,
  },
  {
    id: 8,
    name: 'item7',
    parentId: 5,
  },
  {
    id: 9,
    name: 'item8',
    parentId: 8,
  },
  {
    id: 10,
    name: 'root2',
    parentId: 0,
  },
  {
    id: 11,
    name: 'item9',
    parentId: 10,
  },
  {
    id: 12,
    name: 'item10',
    parentId: 10,
  },
];

Simple Example

import React from 'react';
import MultiTree from 'react-multi-checkbox-tree';
import { treeItem } from 'treeItem';

export default function () {
  return <MultiTree treeId="treeItems" items={treeItem} checkboxCount={2} />;
}

Custom Style Example

customStyle-examples

...
import CheckBoxIcon from '@mui/icons-material/CheckBox';
import CheckBoxOutlineBlankIcon from '@mui/icons-material/CheckBoxOutlineBlank';
import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox';

export default function () {
  return (
    <MultiTree
      treeId="treeItems"
      items={treeItem}
      checkboxCount={2}
      icons={{
        indeterminate: <IndeterminateCheckBoxIcon />,
        check: <CheckBoxIcon />,
        unCheck: <CheckBoxOutlineBlankIcon />,
      }}
    />
  );
}

Checkbox Position Example

customStyle-examples

...
export default function () {
  return (
    <MultiTree
      treeId="treeItems"
      items={treeItem}
      checkboxCount={3}
      checkboxPosition="attachLeft"
    />
  );
}

Props

This document lists all props of MultiTree component.

| Name | Type | Default | Description | | | -------------------- | ------------------------------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | treeId | string | '' | It is a unique tree name. Required when constructing multiple trees | | | items | Item[] | [] | Dataset to build the tree | | | checkboxCount | number | 1 | The number of checkboxes | | | checkboxPosition | 'detachLeft'| 'attachLeft'| 'attachRight' | 'detachLeft' | The position of the checkbox | | | checkboxDistance | number | 5 | If the checkbox position is 'detachLeft', it defines the distance from the item | | | indent | number | 24 | The size of the checkbox is 24*24. If you use a custom checkbox with a different size, you must set it to the same length | | | icons | object | {} | Apply custom icon | { indeterminate: ReactElement, check: ReactElement, unCheck: ReactElement, expand: ReactElement, collapse: ReactElement} | | disable | boolean | false | Disable the checkbox | | | isChecked | boolean | true | Indicates a checked state | | | isExpand | boolean | true | Indicates a extended state | | | onCheck | function | () => {} | Event that occurs when a checkbox is clicked | | | onExpand | function | () => {} | Event that occurs whan a checkbox expands and collapses | | | initCheckStates | function | () => {} | Determines whether each item is checked or not | | | checkedItems | string[] | [] | Determines whether the checkbox is checked by 'checkboxName'. You need to add a checkbox name to the dataset. | /* 'checkboxName' is the same as the number of checkboxes, and each name is given in order */ treeItem = [{ id: 1, name: 'root1', parentId: 0, checkboxName: ['write', 'read'] ...} |