Skip to content

Nested Indent Guide

A copy-paste drag & drop component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Drag & DropHTMLCSSany framework

Press Alt plus Arrow Right to nest this item under the one above it, or Alt plus Arrow Left to un-nest.

  • Project brief
  • Research notes
  • Wireframes

Copy into your project

HTML
<!-- Nested Indent Guide — add .nuda-dd2-indent-guide__item--nest while an
     item is dragged rightward to become a child; the rail marks its new
     parent. Keyboard: focus an item, Alt+ArrowRight nests, Alt+ArrowLeft un-nests. -->
<div class="nuda-dd2-indent-guide">
  <p id="dd2-indent-guide-desc" class="nuda-dd2-indent-guide__sr">Press Alt plus Arrow Right to nest this item under the one above it, or Alt plus Arrow Left to un-nest.</p>
  <ul class="nuda-dd2-indent-guide__list" role="listbox" aria-label="Outline" aria-describedby="dd2-indent-guide-desc">
    <li class="nuda-dd2-indent-guide__item" role="option" aria-selected="false">Project brief</li>
    <li class="nuda-dd2-indent-guide__item nuda-dd2-indent-guide__item--nest" role="option" aria-selected="true" tabindex="0">
      <span class="nuda-dd2-indent-guide__rail" aria-hidden="true"></span>
      Research notes
    </li>
    <li class="nuda-dd2-indent-guide__item" role="option" aria-selected="false">Wireframes</li>
  </ul>
</div>
CSS
.nuda-dd2-indent-guide {
  width: 170px;
}

.nuda-dd2-indent-guide__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.nuda-dd2-indent-guide__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nuda-dd2-indent-guide__item {
  position: relative;
  padding: 7px 10px;
  background: #161616;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 7px;
  font: 500 11px ui-sans-serif,system-ui;
  color: #cfcfcf;
}

.nuda-dd2-indent-guide__item:focus-visible {
  outline: 2px solid #e4ff54;
  outline-offset: 2px;
}

.nuda-dd2-indent-guide__item--nest {
  color: #fafafa;
  border-color: rgba(228,255,84,.4);
  animation: nuda-dd2-indent-guide-nest 3s ease-in-out infinite;
}

.nuda-dd2-indent-guide__rail {
  position: absolute;
  left: -1px;
  top: -7px;
  bottom: -1px;
  width: 2px;
  background: #e4ff54;
  border-radius: 2px;
  opacity: 0;
  animation: nuda-dd2-indent-guide-rail 3s ease-in-out infinite;
}

@keyframes nuda-dd2-indent-guide-nest {
  0%,16%,100% {
    transform: translateX(0);
  }
  45%,75% {
    transform: translateX(16px);
  }
}

@keyframes nuda-dd2-indent-guide-rail {
  0%,16%,100% {
    opacity: 0;
  }
  45%,75% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-dd2-indent-guide__item--nest,.nuda-dd2-indent-guide__rail {
    animation: none;
  }
}

How to use Nested Indent Guide

Paste the HTML where you need it and the CSS into a global stylesheet (or a <style> tag). Every class is prefixed nuda- so it never collides with Tailwind or your own styles. Tweak the CSS custom properties to match your design system.

Works in React, Vue, Svelte, Astro, Next.js, Nuxt, Laravel Blade, Django, Rails — or a single .html file. No npm install, no build step.

More drag & drop components

← Browse all NudaUI components