Skip to content

Sortable List

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

Drag & DropHTMLCSSany framework
  • Plan launch
  • Write changelog
  • Review PR #42

Copy into your project

HTML
<!-- Sortable List — toggle .is-dragging on the active item from JS / your dnd lib -->
<ul class="nuda-sort">
  <li class="nuda-sort__item">
    <span class="nuda-sort__handle" aria-hidden="true">⋮⋮</span>
    <span class="nuda-sort__label">Plan launch</span>
  </li>
  <li class="nuda-sort__item is-dragging">
    <span class="nuda-sort__handle" aria-hidden="true">⋮⋮</span>
    <span class="nuda-sort__label">Write changelog</span>
  </li>
  <li class="nuda-sort__item">
    <span class="nuda-sort__handle" aria-hidden="true">⋮⋮</span>
    <span class="nuda-sort__label">Review PR #42</span>
  </li>
</ul>
CSS
/* Sortable List
   Drag-handle rows; .is-dragging tilts and lifts the active row.
   Customize: --sort-accent, --sort-bg */

.nuda-sort {
  --sort-accent: #e4ff54;
  --sort-bg: rgba(255, 255, 255, 0.03);
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  max-width: 280px;
}

.nuda-sort__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--sort-bg);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  cursor: grab;
  transition:
    border-color 0.2s,
    background 0.2s,
    transform 0.2s,
    box-shadow 0.2s;
}

.nuda-sort__item:hover {
  border-color: rgba(228, 255, 84, 0.2);
  background: rgba(255, 255, 255, 0.05);
}

.nuda-sort__item:active { cursor: grabbing; }

.nuda-sort__item.is-dragging {
  border-color: var(--sort-accent);
  background: rgba(228, 255, 84, 0.06);
  transform: scale(1.02) rotate(-0.5deg);
  box-shadow:
    0 8px 24px -8px rgba(228, 255, 84, 0.4),
    0 4px 8px rgba(0, 0, 0, 0.3);
  z-index: 10;
}

.nuda-sort__handle {
  color: #63636e;
  font: 700 0.75rem ui-sans-serif, system-ui, sans-serif;
  letter-spacing: -1px;
  cursor: grab;
  user-select: none;
  transition: color 0.2s;
}

.nuda-sort__item:hover .nuda-sort__handle { color: var(--sort-accent); }

.nuda-sort__label {
  font: 500 0.875rem ui-sans-serif, system-ui, sans-serif;
  color: #fafafa;
}

How to use Sortable List

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