JSFiddle - React, Tailwind, and code Playground
by velo_ninja
HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Professional Folder Tree</title>
<style>
body {
font-family: 'Segoe UI', sans-serif;
background: #f0f2f5;
padding: 40px;
}
.tree {
background: white;
border-radius: 12px;
padding: 20px;
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
max-width: 500px;
}
.tree ul {
list-style-type: none;
padding-left: 20px;
margin: 0;
border-left: 1px solid #ccc;
position: relative;
}
.tree li {
position: relative;
padding-left: 20px;
margin: 0;
}
.tree li::before {
content: "";
position: absolute;
top: 0;
left: 0;
width: 20px;
height: 1px;
background: #ccc;
}
.tree li:last-child::after {
content: "";
position: absolute;
top: 1em;
left: -1px;
width: 1px;
height: 100%;
background: white; /* hides bottom vertical line */
}
.caret {
cursor: pointer;
user-select: none;
display: inline-block;
padding: 3px 6px;
border-radius: 4px;
transition: background 0.2s ease;
}
.caret::before {
content: "▶";
display: inline-block;
margin-right: 6px;
transition: transform 0.2s ease;
}
.caret-down::before {
transform: rotate(90deg);
}
.nested {
display: none;
}
.nested.active {
display: block;
}
.highlight > .caret,
.highlight > span.file {
color: red;
font-weight: bold;
}
.highlight {
border-left: 2px solid red;
}
</style>
</head>
<body>
<div class="tree">
<ul>
<li>
<span class="caret">Projects</span>
<ul class="nested active">
<li>
<span class="caret">2025 Website</span>
<ul class="nested">
...