Problem Brief
Build a recursive VS Code-style file tree where users can toggle folder expansion, add child files/folders, and delete nodes.
Requirements
- Render tree nodes inside `[data-testid="file-tree"]` with `.tree-node` rows.
- Clicking `[data-toggle]` on a folder toggles child visibility and sets `aria-expanded`.
- Clicking `[data-add-file]` appends a child file node inside that folder.
- Clicking `[data-delete]` removes the node (and its descendants) from the DOM.
Progressive Hints (1)
- Keep a recursive tree state object (`{ id, name, type, expanded, children }`) and re-render cleanly into `[data-testid="file-tree"]`.
Reference Solution
Stuck? Load the verified reference code into your editor.
Automated Test Suite
3 Test Cases Ready- Toggles collapsed subfolder open and closedClicking components toggle reveals button.ts and toggles aria-expanded
- Adds new file inside folderClicking +File on src adds a new file node
- Deletes file node cleanlyClicking delete removes app.ts node
Live Sandboxed Previewiframe sandbox