{
  "id": "icon-rail-sidebar",
  "name": "Expanding Icon Sidebar",
  "category": "navigation",
  "tags": [
    "sidebar",
    "icon rail",
    "collapsible",
    "hover",
    "focus-within",
    "dashboard"
  ],
  "description": "A slim icon-only sidebar rail that widens to show labels on hover or keyboard focus.",
  "url": "https://copy-css.com/snippets/icon-rail-sidebar",
  "markdown": "https://copy-css.com/snippets/icon-rail-sidebar.md",
  "html": "<nav class=\"rail\" aria-label=\"Main\">\n  <a href=\"#\" aria-current=\"page\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M3 11l9-8 9 8\"/><path d=\"M5 10v10h14V10\"/></svg>\n    <span>Home</span>\n  </a>\n  <a href=\"#\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"11\" cy=\"11\" r=\"7\"/><path d=\"m20 20-3.5-3.5\"/></svg>\n    <span>Search</span>\n  </a>\n  <a href=\"#\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><path d=\"M3 20h18M7 16V9M12 16V5M17 16v-4\"/></svg>\n    <span>Reports</span>\n  </a>\n  <a href=\"#\">\n    <svg viewBox=\"0 0 24 24\" aria-hidden=\"true\"><circle cx=\"12\" cy=\"8\" r=\"4\"/><path d=\"M4 21a8 8 0 0 1 16 0\"/></svg>\n    <span>Profile</span>\n  </a>\n</nav>",
  "css": ".rail {\n  display: flex;\n  flex-direction: column;\n  gap: 2px;\n  box-sizing: border-box;\n  width: 60px;\n  padding: 8px;\n  overflow: hidden;\n  border-radius: 16px;\n  background: #0f172a;\n  transition: width 0.25s ease;\n}\n\n.rail:hover,\n.rail:focus-within {\n  width: 180px;\n}\n\n.rail a {\n  display: flex;\n  align-items: center;\n  gap: 14px;\n  padding: 9px 11px;\n  border-radius: 10px;\n  color: #94a3b8;\n  font: 500 14px system-ui, sans-serif;\n  text-decoration: none;\n  white-space: nowrap;\n}\n\n.rail svg {\n  flex: none;\n  width: 18px;\n  height: 18px;\n  fill: none;\n  stroke: currentColor;\n  stroke-width: 2;\n  stroke-linecap: round;\n  stroke-linejoin: round;\n}\n\n/* Labels stay in the accessibility tree, only faded out */\n.rail span {\n  opacity: 0;\n  transition: opacity 0.2s ease;\n}\n\n.rail:hover span,\n.rail:focus-within span {\n  opacity: 1;\n}\n\n.rail a:hover,\n.rail a[aria-current=\"page\"] {\n  background: #1e293b;\n  color: #f8fafc;\n}\n\n.rail a:focus-visible {\n  outline: 2px solid #38bdf8;\n  outline-offset: -2px;\n}\n\n@media (prefers-reduced-motion: reduce) {\n  .rail,\n  .rail span { transition: none; }\n}",
  "features": [
    "transitions",
    "Flexbox",
    "keyboard focus styles",
    "reduced-motion support"
  ],
  "customProperties": []
}
