Skip to content

Hover-Expand Rail

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

Sidebars & DocksHTMLCSSany framework

Copy into your project

HTML
<nav aria-label="Main" class="nuda-sb2-hover-rail">
  <ul class="nuda-sb2-hover-rail__list">
    <li>
      <a href="#" class="nuda-sb2-hover-rail__item" aria-current="page">
        <span class="nuda-sb2-hover-rail__icon" aria-hidden="true">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
               stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
            <path d="M3 11l9-8 9 8v10a2 2 0 01-2 2h-4v-7H9v7H5a2 2 0 01-2-2V11z" />
          </svg>
        </span>
        <span class="nuda-sb2-hover-rail__label">Home</span>
      </a>
    </li>
    <!-- More items -->
  </ul>
</nav>
CSS
.nuda-sb2-hover-rail {
  width: fit-content;
  padding: 8px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
}

.nuda-sb2-hover-rail__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nuda-sb2-hover-rail__item {
  display: grid;
  grid-template-columns: 32px 0fr;
  align-items: center;
  column-gap: 0;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: #a0a0a8;
  text-decoration: none;
  transition: grid-template-columns .4s cubic-bezier(.16,1,.3,1),column-gap .4s cubic-bezier(.16,1,.3,1),background .2s,color .2s;
}

.nuda-sb2-hover-rail__item:hover {
  background: rgba(255,255,255,.05);
  color: #fafafa;
}

.nuda-sb2-hover-rail__item[aria-current="page"] {
  color: #e4ff54;
  background: rgba(228,255,84,.08);
}

.nuda-sb2-hover-rail__item:focus-visible {
  outline: 2px solid #e4ff54;
  outline-offset: 2px;
}

.nuda-sb2-hover-rail__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
}

.nuda-sb2-hover-rail__icon svg {
  width: 18px;
  height: 18px;
}

.nuda-sb2-hover-rail__label {
  overflow: hidden;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity .3s ease,transform .35s cubic-bezier(.16,1,.3,1);
}

.nuda-sb2-hover-rail:hover .nuda-sb2-hover-rail__item,.nuda-sb2-hover-rail:focus-within .nuda-sb2-hover-rail__item {
  grid-template-columns: 32px 1fr;
  column-gap: 10px;
}

.nuda-sb2-hover-rail:hover .nuda-sb2-hover-rail__label,.nuda-sb2-hover-rail:focus-within .nuda-sb2-hover-rail__label {
  opacity: 1;
  transform: translateX(0);
}

@media (prefers-reduced-motion:reduce) {
  .nuda-sb2-hover-rail__item,.nuda-sb2-hover-rail__label {
    transition: none;
  }
}

How to use Hover-Expand Rail

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 sidebars & docks components

← Browse all NudaUI components