04 / 32
All 32 in 32 CSS Accordions — Vertical & Horizontal
- 01Pure CSS FAQ Accordion with <details> and <summary> (No JavaScript)
- 02Mobile Navigation Accordion Menu (CSS-Only Hamburger + Drill-Down)
- 03E-commerce Filter Sidebar Accordion with Exclusive Open (Product Filters)
- 04Nested Multi-Level Accordion (CSS Tree View for Docs & File Explorers)
- 05Smoothly Animated <details> Accordion — Transition height: auto in Pure CSS
- 06Exclusive Single-Open Accordion with the details name Attribute (Close Others Automatically)
- 07Underline Reveal Accordion — Editorial Minimal with Animated Rules
- 08Numbered Steps Accordion — Process Timeline for Onboarding Flows
- 09Plus / Minus Morph Accordion — CSS-Drawn Icon Animation
- 10Chevron Rotate Card Accordion — The Production Default, Perfected
- 11Brutalist Stamp Accordion — Bold Borders, Hard Shadows, Zero Subtlety
- 12Glassmorphism Frosted Accordion with backdrop-filter Blur
- 13Minimal Rail Accordion — Timeline Dot Spine for Changelogs & Roadmaps
- 14Card Lift Accordion — Elevation & Scale on Open (Material-Style Depth)
- 15Diagonal Slant Accordion — Skewed Parallelogram Headers
- 16Stepped Stair Accordion — Indented Cascade with Depth Levels
- 17Circular Dial Accordion — Conic-Gradient Progress Ring Toggles
- 18Marquee Header Accordion — Scrolling Ticker Titles on the Open Item
- 19Code Comment Accordion — Editor-Themed Collapsible Doc Blocks
- 20Paper Fold 3D Accordion — perspective + rotateX Unfolding Panels
- 21Equalizer Accordion — Animated Level Bars for Playlists & Audio
- 22Stacked Cards Deck Accordion — Overlapping Pull-Out Hand
- 23Holographic Slot Accordion — @property Rotating Border Sheen
- 24Aurora Drift Accordion — Dark Ambient Glow that Follows the Open Item
- 25Horizontal Strip Tabs Accordion — Vertical Text Columns with flex-grow
- 26Horizontal Image Reveal Accordion — Expanding Photo Gallery Panels
- 27Color Block Horizontal Accordion — Bold Flat Panels for Feature Sections
- 28Numbered Spine Horizontal Accordion — Editorial Magazine Index
- 29Curtain Slide Horizontal Accordion — clip-path Reveal Panels
- 30Vinyl Spine Horizontal Accordion — Record Shelf with Pull-Out Sleeves
- 31Cinema Reel Horizontal Accordion — Dark Letterboxed Showcase
- 32Aurora Strip Horizontal Accordion — Animated Gradient Glow Panels
Nested Multi-Level Accordion (CSS Tree View for Docs & File Explorers)
Three levels of <details> nested like a file explorer: folder chevrons, connector tree-lines drawn with borders, per-level indentation and file-type dots — the recursive structure devs need for documentation sidebars, org charts and directory browsers, with hierarchy you can read at a glance.
Build interactive UI like this from scratch: 20 HTML, CSS & JavaScript projects
ZTM · JavaScript Web Projects · 30‑day money-back guarantee · Affiliate link
The code
<section class="acc-04" aria-label="Nested multi-level accordion tree demo">
<div class="acc-04__panel">
<p class="acc-04__crumb">docs / <b>design-system</b></p>
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Foundations</summary>
<div class="acc-04__kids">
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Color</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">palette.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">semantic-tokens.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#e0a63c">contrast-audit.xlsx</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Typography</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">type-scale.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#c95ddb">specimens.fig</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">spacing.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Components</summary>
<div class="acc-04__kids">
<details class="acc-04__branch">
<summary class="acc-04__folder">Forms</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">inputs.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">validation.md</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">accordion.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">navigation.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Release notes</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.2.0.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.1.4.md</a>
</div>
</details>
</div>
</section><section class="acc-04" aria-label="Nested multi-level accordion tree demo">
<div class="acc-04__panel">
<p class="acc-04__crumb">docs / <b>design-system</b></p>
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Foundations</summary>
<div class="acc-04__kids">
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Color</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">palette.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">semantic-tokens.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#e0a63c">contrast-audit.xlsx</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Typography</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">type-scale.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#c95ddb">specimens.fig</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">spacing.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Components</summary>
<div class="acc-04__kids">
<details class="acc-04__branch">
<summary class="acc-04__folder">Forms</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">inputs.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">validation.md</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">accordion.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">navigation.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Release notes</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.2.0.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.1.4.md</a>
</div>
</details>
</div>
</section>.acc-04,
.acc-04 *,
.acc-04 *::before,
.acc-04 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-04 {
--accent: oklch(0.55 0.15 265);
--line: #dcdfeb;
--indent: 22px;
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef0f6;
padding: 40px 20px;
}
.acc-04__panel {
width: min(380px,100%);
background: #fff;
border-radius: 16px;
padding: 22px 20px 26px;
box-shadow: 0 24px 60px -34px rgba(30,35,80,.35);
}
.acc-04__crumb {
font-family: ui-monospace,Menlo,monospace;
font-size: 12px;
color: #8a90a8;
margin-bottom: 12px;
}
.acc-04__crumb b {
color: #2a3050;
}
.acc-04__folder {
list-style: none;
display: flex;
align-items: center;
gap: 9px;
min-height: 40px;
padding: 0 8px;
font-size: 14.5px;
font-weight: 600;
color: #2a3050;
cursor: pointer;
border-radius: 8px;
transition: background .15s;
}
.acc-04__folder::-webkit-details-marker {
display: none;
}
.acc-04__folder::marker {
content: "";
}
.acc-04__folder:hover {
background: #f3f5fa;
}
.acc-04__folder::before {
content: "";
width: 7px;
height: 7px;
border-right: 2px solid #9aa1bd;
border-bottom: 2px solid #9aa1bd;
transform: rotate(-45deg);
transition: transform .2s;
flex: none;
margin-left: 2px;
}
.acc-04__branch[open] > .acc-04__folder::before {
transform: rotate(45deg);
}
.acc-04__branch[open] > .acc-04__folder {
font-weight: 750;
color: var(--accent);
}
.acc-04__kids {
margin-left: var(--indent);
border-left: 1.5px solid var(--line);
padding-left: 6px;
display: flex;
flex-direction: column;
}
.acc-04__leaf {
display: flex;
align-items: center;
gap: 9px;
min-height: 38px;
padding: 0 8px;
font-size: 13.5px;
color: #4b5270;
text-decoration: none;
border-radius: 8px;
transition: background .15s;
}
.acc-04__leaf:hover {
background: #f3f5fa;
color: var(--accent);
}
.acc-04__leaf::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--dot,#9aa1bd);
flex: none;
margin-left: 1px;
}
.acc-04__folder:focus-visible,
.acc-04__leaf:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
.acc-04__folder::before {
transition: none;
}
}.acc-04,
.acc-04 *,
.acc-04 *::before,
.acc-04 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-04 {
--accent: oklch(0.55 0.15 265);
--line: #dcdfeb;
--indent: 22px;
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef0f6;
padding: 40px 20px;
}
.acc-04__panel {
width: min(380px,100%);
background: #fff;
border-radius: 16px;
padding: 22px 20px 26px;
box-shadow: 0 24px 60px -34px rgba(30,35,80,.35);
}
.acc-04__crumb {
font-family: ui-monospace,Menlo,monospace;
font-size: 12px;
color: #8a90a8;
margin-bottom: 12px;
}
.acc-04__crumb b {
color: #2a3050;
}
.acc-04__folder {
list-style: none;
display: flex;
align-items: center;
gap: 9px;
min-height: 40px;
padding: 0 8px;
font-size: 14.5px;
font-weight: 600;
color: #2a3050;
cursor: pointer;
border-radius: 8px;
transition: background .15s;
}
.acc-04__folder::-webkit-details-marker {
display: none;
}
.acc-04__folder::marker {
content: "";
}
.acc-04__folder:hover {
background: #f3f5fa;
}
.acc-04__folder::before {
content: "";
width: 7px;
height: 7px;
border-right: 2px solid #9aa1bd;
border-bottom: 2px solid #9aa1bd;
transform: rotate(-45deg);
transition: transform .2s;
flex: none;
margin-left: 2px;
}
.acc-04__branch[open] > .acc-04__folder::before {
transform: rotate(45deg);
}
.acc-04__branch[open] > .acc-04__folder {
font-weight: 750;
color: var(--accent);
}
.acc-04__kids {
margin-left: var(--indent);
border-left: 1.5px solid var(--line);
padding-left: 6px;
display: flex;
flex-direction: column;
}
.acc-04__leaf {
display: flex;
align-items: center;
gap: 9px;
min-height: 38px;
padding: 0 8px;
font-size: 13.5px;
color: #4b5270;
text-decoration: none;
border-radius: 8px;
transition: background .15s;
}
.acc-04__leaf:hover {
background: #f3f5fa;
color: var(--accent);
}
.acc-04__leaf::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--dot,#9aa1bd);
flex: none;
margin-left: 1px;
}
.acc-04__folder:focus-visible,
.acc-04__leaf:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
.acc-04__folder::before {
transition: none;
}
}/* No JavaScript — details elements nest recursively; indentation + border-left connector lines make depth legible, and the same classes work at every level. */
/* No JavaScript — details elements nest recursively; indentation + border-left connector lines make depth legible, and the same classes work at every level. */Here's a working CSS Accordions — Vertical & Horizontal from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Nested Multi-Level Accordion (CSS Tree View for Docs & File Explorers)
Source: https://codefronts.com/navigation/css-accordions/nested-multi-level-accordion-tree-view/
Three levels of <details> nested like a file explorer: folder chevrons, connector tree-lines drawn with borders, per-level indentation and file-type dots — the recursive structure devs need for documentation sidebars, org charts and directory browsers, with hierarchy you can read at a glance.
## HTML
```html
<section class="acc-04" aria-label="Nested multi-level accordion tree demo">
<div class="acc-04__panel">
<p class="acc-04__crumb">docs / <b>design-system</b></p>
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Foundations</summary>
<div class="acc-04__kids">
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Color</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">palette.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">semantic-tokens.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#e0a63c">contrast-audit.xlsx</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Typography</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">type-scale.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#c95ddb">specimens.fig</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">spacing.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Components</summary>
<div class="acc-04__kids">
<details class="acc-04__branch">
<summary class="acc-04__folder">Forms</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">inputs.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">validation.md</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">accordion.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">navigation.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Release notes</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.2.0.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.1.4.md</a>
</div>
</details>
</div>
</section>
```
## CSS
```css
.acc-04,
.acc-04 *,
.acc-04 *::before,
.acc-04 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-04 {
--accent: oklch(0.55 0.15 265);
--line: #dcdfeb;
--indent: 22px;
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef0f6;
padding: 40px 20px;
}
.acc-04__panel {
width: min(380px,100%);
background: #fff;
border-radius: 16px;
padding: 22px 20px 26px;
box-shadow: 0 24px 60px -34px rgba(30,35,80,.35);
}
.acc-04__crumb {
font-family: ui-monospace,Menlo,monospace;
font-size: 12px;
color: #8a90a8;
margin-bottom: 12px;
}
.acc-04__crumb b {
color: #2a3050;
}
.acc-04__folder {
list-style: none;
display: flex;
align-items: center;
gap: 9px;
min-height: 40px;
padding: 0 8px;
font-size: 14.5px;
font-weight: 600;
color: #2a3050;
cursor: pointer;
border-radius: 8px;
transition: background .15s;
}
.acc-04__folder::-webkit-details-marker {
display: none;
}
.acc-04__folder::marker {
content: "";
}
.acc-04__folder:hover {
background: #f3f5fa;
}
.acc-04__folder::before {
content: "";
width: 7px;
height: 7px;
border-right: 2px solid #9aa1bd;
border-bottom: 2px solid #9aa1bd;
transform: rotate(-45deg);
transition: transform .2s;
flex: none;
margin-left: 2px;
}
.acc-04__branch[open] > .acc-04__folder::before {
transform: rotate(45deg);
}
.acc-04__branch[open] > .acc-04__folder {
font-weight: 750;
color: var(--accent);
}
.acc-04__kids {
margin-left: var(--indent);
border-left: 1.5px solid var(--line);
padding-left: 6px;
display: flex;
flex-direction: column;
}
.acc-04__leaf {
display: flex;
align-items: center;
gap: 9px;
min-height: 38px;
padding: 0 8px;
font-size: 13.5px;
color: #4b5270;
text-decoration: none;
border-radius: 8px;
transition: background .15s;
}
.acc-04__leaf:hover {
background: #f3f5fa;
color: var(--accent);
}
.acc-04__leaf::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--dot,#9aa1bd);
flex: none;
margin-left: 1px;
}
.acc-04__folder:focus-visible,
.acc-04__leaf:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
.acc-04__folder::before {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — details elements nest recursively; indentation + border-left connector lines make depth legible, and the same classes work at every level. */
```Here's a working CSS Accordions — Vertical & Horizontal from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Nested Multi-Level Accordion (CSS Tree View for Docs & File Explorers)
Source: https://codefronts.com/navigation/css-accordions/nested-multi-level-accordion-tree-view/
Three levels of <details> nested like a file explorer: folder chevrons, connector tree-lines drawn with borders, per-level indentation and file-type dots — the recursive structure devs need for documentation sidebars, org charts and directory browsers, with hierarchy you can read at a glance.
## HTML
```html
<section class="acc-04" aria-label="Nested multi-level accordion tree demo">
<div class="acc-04__panel">
<p class="acc-04__crumb">docs / <b>design-system</b></p>
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Foundations</summary>
<div class="acc-04__kids">
<details class="acc-04__branch" open>
<summary class="acc-04__folder">Color</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">palette.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">semantic-tokens.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#e0a63c">contrast-audit.xlsx</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Typography</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">type-scale.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#c95ddb">specimens.fig</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">spacing.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Components</summary>
<div class="acc-04__kids">
<details class="acc-04__branch">
<summary class="acc-04__folder">Forms</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">inputs.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">validation.md</a>
</div>
</details>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">accordion.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#5b8def">navigation.md</a>
</div>
</details>
<details class="acc-04__branch">
<summary class="acc-04__folder">Release notes</summary>
<div class="acc-04__kids">
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.2.0.md</a>
<a href="#" class="acc-04__leaf" style="--dot:#54b06d">v3.1.4.md</a>
</div>
</details>
</div>
</section>
```
## CSS
```css
.acc-04,
.acc-04 *,
.acc-04 *::before,
.acc-04 *::after {
box-sizing: border-box;
margin: 0;
padding: 0;
}
.acc-04 {
--accent: oklch(0.55 0.15 265);
--line: #dcdfeb;
--indent: 22px;
font-family: 'Segoe UI',system-ui,sans-serif;
width: 100%;
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
background: #eef0f6;
padding: 40px 20px;
}
.acc-04__panel {
width: min(380px,100%);
background: #fff;
border-radius: 16px;
padding: 22px 20px 26px;
box-shadow: 0 24px 60px -34px rgba(30,35,80,.35);
}
.acc-04__crumb {
font-family: ui-monospace,Menlo,monospace;
font-size: 12px;
color: #8a90a8;
margin-bottom: 12px;
}
.acc-04__crumb b {
color: #2a3050;
}
.acc-04__folder {
list-style: none;
display: flex;
align-items: center;
gap: 9px;
min-height: 40px;
padding: 0 8px;
font-size: 14.5px;
font-weight: 600;
color: #2a3050;
cursor: pointer;
border-radius: 8px;
transition: background .15s;
}
.acc-04__folder::-webkit-details-marker {
display: none;
}
.acc-04__folder::marker {
content: "";
}
.acc-04__folder:hover {
background: #f3f5fa;
}
.acc-04__folder::before {
content: "";
width: 7px;
height: 7px;
border-right: 2px solid #9aa1bd;
border-bottom: 2px solid #9aa1bd;
transform: rotate(-45deg);
transition: transform .2s;
flex: none;
margin-left: 2px;
}
.acc-04__branch[open] > .acc-04__folder::before {
transform: rotate(45deg);
}
.acc-04__branch[open] > .acc-04__folder {
font-weight: 750;
color: var(--accent);
}
.acc-04__kids {
margin-left: var(--indent);
border-left: 1.5px solid var(--line);
padding-left: 6px;
display: flex;
flex-direction: column;
}
.acc-04__leaf {
display: flex;
align-items: center;
gap: 9px;
min-height: 38px;
padding: 0 8px;
font-size: 13.5px;
color: #4b5270;
text-decoration: none;
border-radius: 8px;
transition: background .15s;
}
.acc-04__leaf:hover {
background: #f3f5fa;
color: var(--accent);
}
.acc-04__leaf::before {
content: "";
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--dot,#9aa1bd);
flex: none;
margin-left: 1px;
}
.acc-04__folder:focus-visible,
.acc-04__leaf:focus-visible {
outline: 3px solid var(--accent);
outline-offset: 1px;
}
@media (prefers-reduced-motion: reduce) {
.acc-04__folder::before {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — details elements nest recursively; indentation + border-left connector lines make depth legible, and the same classes work at every level. */
```How this works
Nesting <details> inside <details> just works — each level toggles independently and keyboard flow follows document order. The design work is making depth legible: every child list gets margin-left plus a border-left connector line, so the eye traces parent→child like a tree diagram, and each nesting level re-uses the same classes — the structure is genuinely recursive, so templating loops render it directly.
Leaf rows (files) are plain links with a colored dot keyed by type via --dot; branch rows (folders) are summaries with a caret that rotates 90° when open — the same affordance at every depth keeps the mental model consistent. A subtle [open] font-weight bump marks which branches along your path are expanded.
Techniques used: recursive details-in-details nesting (no depth-specific CSS) · border-left connector lines + margin-left indentation rhythm · caret rotate(90deg) folder affordance · type-coded leaf dots via per-item --dot custom property · consistent 40px rows at every level for scan rhythm
Make it yours
- Indent width and line color =
--indent/--linetokens. - Add levels freely — the classes are depth-agnostic; recursion is free.
- Leaf dot colors are per-item
--dotinline variables. - Pre-expand a path by adding
opendown the chain.
Gotchas — read before shipping
- Cap real-world nesting at 3 levels — beyond that users lose track of where they are; flatten the taxonomy or add a breadcrumb instead.
- Connector lines are decorative: hierarchy must ALSO be conveyed by the DOM nesting itself (it is — details-in-details), never by indentation alone.
- Don't make the whole row a link AND a toggle — here folders toggle, files navigate, and the two are visually distinct (caret vs dot).
- For huge trees (100+ nodes), details is still fine for rendering, but consider content-visibility:auto on deep branches to keep first paint fast.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 111+ | 15.4+ | 113+ | 111+ |
Floor set by oklch() as this demo is written. The core technique itself goes back further — Chrome all.
Nested details/summary is universally supported — it's just HTML. Everything else is borders, transforms and custom properties.