
Security News
The Nightmare Before Deployment
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.
@idui/react-tree
Advanced tools
npm install --save @idui/react-tree
yarn add @idui/react-tree
import React from 'react'
import Tree from '@idui/react-tree'
const nodes = [
{ label: 'Cake' },
{ label: 'Coffee', children: [
{ label: 'Cappuccino' },
{ label: 'Latte' },
{ label: 'Americano' },
]},
]
function Example() {
return <Tree nodes={nodes} />
}
import React from 'react'
import styled from 'styled-components'
import Tree from '@idui/react-tree'
const CustomTree = styled(Tree)`
border-left: 1px solid #aeaeae;
margin-left: 3.5px;
`;
const CustomLeaf = styled.div`
color: rgba(0, 0, 0, 0.7);
margin-bottom: 2px;
${ifProp(
'hasChildren',
css`
transition: color 0.3s ease-in-out;
cursor: pointer;
&:hover {
color: rgba(0, 0, 0, 1);
}
`
)};
`;
const renderCustomLeaf = ({ toggle, isOpen, icon, label, hasChildren }) => (
<CustomLeaf hasChildren={hasChildren} onClick={toggle}>
{hasChildren && (isOpen ? '▾' : '▸') + ' '}
{icon} {label}
</CustomLeaf>
);
const nodes = [
{
label: 'Cake',
icon: '🍰',
childNodes: [
{
label: 'Chocolate',
icon: '🍫',
},
{
label: 'Vanilla',
icon: '🍬',
},
{
label: 'Strawberry',
icon: '🍓',
},
],
}]
function Example() {
return <Tree nodes={nodes} renderLeaf={renderCustomLeaf} />
}
import React, { useState } from 'react'
import { CheckboxTree } from '@idui/react-tree'
const nodes = [
{ label: 'Cake', id: 'cake' },
{ label: 'Coffee', id: 'coffee', children: [
{ label: 'Cappuccino', id: 'Cappuccino' },
{ label: 'Latte', id: 'Latte' },
{ label: 'Americano', id: 'Americano' },
]},
]
function Example() {
const [checkedKeys, setCheckedKeys] = useState([]);
return (
<CheckboxTree
{...props}
checkedKeys={checkedKeys}
nodes={nodes}
onChange={setCheckedKeys}
/>
);
}
import React, { useState, useCallback } from 'react'
import styled from 'styled-components'
import Tree from '@idui/react-tree'
const nodes = [
{ label: 'Cake' },
{ label: 'Coffee', children: [
{ label: 'Cappuccino' },
{ label: 'Latte' },
{ label: 'Americano' },
]},
]
const SearchTreeLeaf = styled.div`
.highlight {
background-color: #ffa7a7;
}
`;
function Example() {
const [search, setSearch] = useState('');
const handleSearch = useCallback((e) => {
setSearch(e.target.value);
}, []);
return (
<div>
<input type="search" onChange={handleSearch} />
<Tree
nodes={nodes}
search={search}
filterHighlighted
renderLeaf={({ toggle, isOpen, label, hasChildren }) => (
<SearchTreeLeaf onClick={toggle}>
{hasChildren && (isOpen ? '▾' : '▸') + ' '}
<span dangerouslySetInnerHTML={{ __html: label }} />
</SearchTreeLeaf>
)}
/>
</div>
);
}
MIT © kaprisa57@gmail.com
FAQs
React Tree Component
The npm package @idui/react-tree receives a total of 102 weekly downloads. As such, @idui/react-tree popularity was classified as not popular.
We found that @idui/react-tree demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Season’s greetings from Socket, and here’s to a calm end of year: clean dependencies, boring pipelines, no surprises.

Research
/Security News
Impostor NuGet package Tracer.Fody.NLog typosquats Tracer.Fody and its author, using homoglyph tricks, and exfiltrates Stratis wallet JSON/passwords to a Russian IP address.

Security News
Deno 2.6 introduces deno audit with a new --socket flag that plugs directly into Socket to bring supply chain security checks into the Deno CLI.