Syncfusion
syncfusion.com › react › tree grid
React TreeGrid | Lightning Fast Tree Table | Syncfusion
The React TreeGrid (tree table) is a high-performance component. It displays data in a hierarchical (tree-like) structure with a rich set of features.
Published November 14, 2025
Constantin-p
constantin-p.github.io › cp-react-tree-table
cp-react-tree-table: React Tree Table Component
A fast, efficient tree table component for ReactJS.
Videos
React Table with Pagination, Column Filters & Sorting | Next.js ...
14:48
Material React Table V2 - Expand Parsed Tree Table [25] - YouTube
02:00:26
Tanstack Table 8 - Multi-Level Marketing - Nested Tree CRUD ...
13:18
Building a tree component in ReactJS - YouTube
Creating a Searchable React Tree View
11:34
Getting Started with the React TreeView Component - YouTube
Where can I find the Syncfusion React Tree Grid demo?
You can find our React TreeGrid demo, which demonstrates how to render and configure the TreeGrid.
syncfusion.com
syncfusion.com › react › tree grid
React TreeGrid | Lightning Fast Tree Table | Syncfusion
Why should you choose Syncfusion React Tree Grid?
The Syncfusion React Tree Grid provides the following features: · Load large amounts of data by dynamically loading child data on demand. · Include flexible UI interactions like expanding and collapsing parent records, dialog editing, and more. · Flexible data binding with support to use local and remote data sources such as JSON, RESTful services, OData services, and WCF services. · One of the best React Tree Grid in the market that offers feature-rich UI to interact with the software. · Attractive UI appearance with built-in themes such as fabric, bootstrap, etc. · Simple configuration and A
syncfusion.com
syncfusion.com › react › tree grid
React TreeGrid | Lightning Fast Tree Table | Syncfusion
How do I get started with Syncfusion React Tree Grid?
A good place to start would be our comprehensive getting started documentation.
syncfusion.com
syncfusion.com › react › tree grid
React TreeGrid | Lightning Fast Tree Table | Syncfusion
React Suite
rsuitejs.com › home › components › tree table
Tree Table - React Suite
Tree table is a table that displays hierarchical data in a tree structure. It is mainly used to display structured data.
CodeSandbox
codesandbox.io › examples › package › react-table-tree
react-table-tree examples - CodeSandbox
Use this online react-table-tree playground to view and fork react-table-tree example apps and templates on CodeSandbox.
npm
npmjs.com › package › cp-react-tree-table
cp-react-tree-table - npm
A fast, efficient tree table component for ReactJS.. Latest version: 1.1.2, last published: 2 years ago. Start using cp-react-tree-table in your project by running `npm i cp-react-tree-table`. There are 1 other projects in the npm registry using cp-react-tree-table.
» npm install cp-react-tree-table
Published Feb 18, 2024
Version 1.1.2
Author Constantin Panaitescu
GitHub
github.com › constantin-p › cp-react-tree-table
GitHub - constantin-p/cp-react-tree-table: A fast, efficient tree table component for ReactJS.
Starred by 97 users
Forked by 28 users
Languages TypeScript 87.7% | JavaScript 12.3% | TypeScript 87.7% | JavaScript 12.3%
DevExtreme
js.devexpress.com › React › Demos › WidgetsGallery › Demo › TreeList › Overview
React Tree List - Overview | React Example
DevExtreme React Tree List is a UI component that displays hierarchical data in a table. Its main features include robust data layer, multiple editing modes, client-side data validation, numerous filtering and searching properties, and many more.
Material React Table
material-react-table.com › docs › examples › expanding tree
Expanding Tree Example - Material React Table V3 Docs
Material React Table supports showing rows in a expanding tree structure. This example is the simplest implementation of this feature where each row of data potentially has a special subRows property that contains an array of sub rows.
Top answer 1 of 2
1
In React, you must break your data into components. Working with the data as is, in multi-level nesting, is considered bad design - see here for a detailed explanation.
With this in mind, I dedicated one component for each nesting level. This way, the row can manage its sub-row hidden state. Here's the final code - see full demo here - click the "toggle" button:
index.js:
import React, { useState, useEffect } from "react";
import "./styles.css"
const Table = () => {
const [items, setItems] = useState([]);
useEffect(() => {
fetchData();
}, []);
const fetchData = async () => {
try {
const response = await fetch("./data.json");
const data = await response.json();
setItems(data);
} catch (e) {
console.warn(e);
}
};
return <div>
{
items.map((data) => {
return <TableData key={data.id} data={data} />
})
}
</div>;
};
const TableData = (props) => {
const data = props.data;
const [subHidden, setSubHidden] = useState(false);
const Id = (dataId) => {
alert(dataId);
};
const Name = (dataName) => {
alert(dataName);
};
const Toggle = () => {
setSubHidden(state => {
return !state;
});
};
return (
<div >
<span> {data.id} </span>
<span> {data.name} </span>
<span> {data.owner} </span>
<span>
<button onClick={() => Id(data.id)}>getId</button>
<button onClick={() => Name(data.name)}>getname</button>
<button onClick={() => Toggle()}>toggle</button>
</span>
<TableSubDetails
subDetails={data.sub_details}
style={{ display: subHidden ? 'none' : 'block'}}
/>
</div>
);
}
const TableSubDetails = (props) => {
const subDetails = props.subDetails;
return (
<div className="subData" style={props.style}>
{
subDetails.map((subData) => {
return <div key={subData.sub_id}>
<span> {subData.sub_id} </span>
<span> {subData.sub_name} </span>
</div>
})
}
</div>
);
}
export default Table;
styles.css:
.subData {
padding: 5px 15px;
}
2 of 2
1
Here is my version of the solution by updating your existing code with some logic
const TableData = () => {
const [oldData, newData] = useState([]);
const [id, setId] = useState({});
useEffect(() => {
fetchData();
}, []);
const Id = (dataId) => {
alert(dataId);
};
const Name = (dataName) => {
alert(dataName);
};
const fetchData = async () => {
try {
newData(jsonData);
} catch (e) {
console.warn(e);
}
};
const updateId = useCallback((dataId) => {
setId((prevState) => {
let updatedState = { ...prevState };
const hasId = updatedState[dataId] ? true : false;
if (hasId) {
delete updatedState[dataId];
} else {
updatedState = { ...updatedState, [dataId]: dataId };
}
return {
...updatedState
};
});
}, []);
const renderTableRows = useCallback(
(details, isChild = false) => {
let renderData = [];
details.forEach((detail) => {
const detailId = isChild ? detail["sub_id"] : detail["id"];
const name = isChild ? detail["sub_name"] : detail["name"];
const childData = (
<tr key={`${name}-${detailId}`}>
<td> {detailId} </td>
<td> {name} </td>
<td> {detail.owner} </td>
<td>
<button onClick={() => Id(detailId)}>getId</button>
<button onClick={() => Name(name)}>getname</button>
{detail.sub_details?.length > 0 && (
<button
onClick={() => {
updateId(detailId);
}}
>
{id[detailId] === detailId ? "Hide" : "Show"} child
</button>
)}
</td>
</tr>
);
renderData.push(childData);
if (id[detailId] === detailId && detail.sub_details?.length > 0) {
const childData = renderTableRows(detail.sub_details, true);
renderData = [...renderData, ...childData];
}
});
return renderData;
},
[id, updateId]
);
const DisplayData = useMemo(() => {
return renderTableRows(oldData);
}, [oldData, renderTableRows]);
return (
<div>
<div>
<table>
<thead>
<tr>
<th>id</th>
<th>name</th>
<th>owner</th>
</tr>
</thead>
<tbody> {DisplayData} </tbody>
</table>
</div>
</div>
);
};
export default TableData;
here is the example link.
Thanks
Svar
docs.svar.dev › guides › configuration › creating the table tree
Creating the table tree | React Grid Documentation
import { Grid } from "@svar-ui/react-grid"; const treeColumns = [ { id: "id", width: 80 }, { id: "lastName", header: "Last Name", flexgrow: 1, treetoggle: true, }, { id: "firstName", header: "First Name" }, { id: "city", width: 100, header: "City" }, ]; const treeData = [ { id: 1, city: "Amieshire", firstName: "Ernest", lastName: "Schuppe", open: false, data: [ { id: "1.1", city: "Gust", firstName: "Janis", lastName: "Vandervort", }, { id: "1.2", city: "Amieshire", firstName: "Makenzie", lastName: "Bode", }, ], }, { id: 2, city: "Amieshire", firstName: "Ciara", lastName: "Towne", data: [ { id: "2.1", city: "Amieshire", firstName: "Suzanne", lastName: "Wolff", }, { id: "2.2", city: "Amieshire", firstName: "Alessandra", lastName: "Feeney", }, ], }, ]; export default function TreeExample() { return <Grid tree={true} data={treeData} columns={treeColumns} />; }