Tree Navigation
The Tree / Folder Navigation with Checkboxes is a React component that displays a hierarchical folder structure with checkboxes for each folder and file. Users can expand/collapse folders and toggle checkboxes to select/deselect items. Selecting a folder automatically selects/deselects all its children, and child selections affect parent checkbox states (e.g., a parent is checked if all children are checked).
Things To Do
-
Hierarchical Display:
- Render a tree of folders and files, with folders expandable/collapsible.
-
Title Rendering:
- Display a title "Folder Navigation".
-
Data as Prop:
- Tree data is passed as a prop from
App.jsand must not be modified, as tests rely on the structure.
- Tree data is passed as a prop from
-
Checkboxes:
- Each folder and file has a checkbox for selection.
-
Parent-Child Sync:
- Checking a folder selects/deselects all its children and child selections update parent state.
-
Interactivity:
- Support toggling folder expansion and checkbox states.
-
Testability:
- Include
data-testidattributes for:tree-container: The root container.node-${id}: Each folder/file node.checkbox-${id}: Each checkbox.toggle-${id}: Folder toggle buttons.
Reference UI

Companies:
Solve Similar questions 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
