<ul class="animated-tree">
<li>
<details open>
<summary>Design System</summary>
<ul>
<li><span class="leaf">Colors</span></li>
<li><span class="leaf">Typography</span></li>
<li>
<details>
<summary>Components</summary>
<ul>
<li><span class="leaf">Button</span></li>
<li><span class="leaf">Card</span></li>
<li><span class="leaf">Dialog</span></li>
</ul>
</details>
</li>
</ul>
</details>
</li>
</ul>
.animated-tree {
interpolate-size: allow-keywords;
margin: 0;
padding: 0;
list-style: none;
display: grid;
gap: 0.35rem;
}
.animated-tree ul {
margin: 0 0 0 1.1rem;
padding-left: 0.9rem;
list-style: none;
border-left: 1px solid #d6ddeb;
}
.animated-tree summary {
display: flex;
align-items: center;
gap: 0.55rem;
width: fit-content;
padding: 0.35rem 0.55rem;
border-radius: 10px;
cursor: pointer;
font-weight: 760;
}
.animated-tree summary::marker {
content: "";
}
.animated-tree summary::before {
content: "";
width: 0.55rem;
height: 0.55rem;
border-right: 2px solid #728096;
border-bottom: 2px solid #728096;
transform: rotate(-45deg);
transition: transform 180ms ease;
}
.animated-tree details[open] > summary::before {
transform: rotate(45deg);
}
.animated-tree details::details-content {
block-size: 0;
overflow: clip;
opacity: 0;
transition:
block-size 240ms ease,
opacity 180ms ease,
content-visibility 240ms ease allow-discrete;
}
.animated-tree details[open]::details-content {
block-size: auto;
opacity: 1;
}
.animated-tree .leaf {
display: block;
width: fit-content;
padding: 0.28rem 0.55rem;
border-radius: 10px;
}
.animated-tree summary:hover,
.animated-tree .leaf:hover {
background: #f1f5ff;
}
@media (prefers-reduced-motion: reduce) {
.animated-tree * {
transition: none !important;
}
}