Build a VS Code-style file explorer with tree view, folder expand/collapse, file icons…
- User
Build a VS Code-style file explorer with tree view, folder expand/collapse, file icons by type, multi-select, and right-click context menu.
Assistant
I have successfully built a full-featured VS Code-style file explorer component using React, Vite, and Tailwind CSS.
Here are the features implemented:
- Tree View & Recursion: Created recursive components (
FileTreeandFileNode) that render the folder and file structure cleanly. - Folder Expand/Collapse: Click on any folder (or its chevron) to toggle expansion state. Double-clicking a folder toggles it too.
- File Icons: Integrated
lucide-reactto display appropriate icons depending on file extensions and specific filenames (likepackage.json,README.md, config files, standard code types, and images). - Multi-select Support: Implemented single-click selection, / click to toggle multiple non-adjacent items, and click for range selection spanning visually consecutive items regardless of tree depth.
- Tree View & Recursion: Created recursive components (
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.