{
  "id": "table-of-contents",
  "name": "Table of Contents",
  "category": "navigation",
  "tags": [
    "toc",
    "contents",
    "counters",
    "docs",
    "sidebar",
    "numbered"
  ],
  "description": "A docs-style \"On this page\" list with automatic 1, 1.1, 1.2 numbering from CSS counters.",
  "url": "https://copy-css.com/snippets/table-of-contents",
  "markdown": "https://copy-css.com/snippets/table-of-contents.md",
  "html": "<nav class=\"toc\" aria-label=\"On this page\">\n  <ol>\n    <li><a href=\"#\">Getting started</a>\n      <ol>\n        <li><a href=\"#\" aria-current=\"true\">Install</a></li>\n        <li><a href=\"#\">Configure</a></li>\n      </ol>\n    </li>\n    <li><a href=\"#\">Usage</a></li>\n    <li><a href=\"#\">FAQ</a></li>\n  </ol>\n</nav>",
  "css": ".toc {\n  font: 14px/1.4 system-ui, sans-serif;\n}\n\n.toc ol {\n  margin: 0;\n  padding: 0;\n  list-style: none;\n  counter-reset: toc;\n}\n\n.toc li {\n  counter-increment: toc;\n}\n\n.toc a {\n  display: flex;\n  gap: 8px;\n  padding: 5px 14px;\n  border-left: 2px solid #e4e4e7;\n  color: #52525b;\n  text-decoration: none;\n  transition: color 0.2s ease, border-color 0.2s ease;\n}\n\n/* 1, 1.1, 1.2, 2 ... */\n.toc a::before {\n  content: counters(toc, \".\");\n  color: #a1a1aa;\n  font-variant-numeric: tabular-nums;\n}\n\n.toc ol ol a {\n  padding-left: 28px;\n}\n\n.toc a:hover {\n  color: #18181b;\n}\n\n.toc a[aria-current] {\n  border-color: #2563eb;\n  color: #2563eb;\n  font-weight: 600;\n}\n\n.toc a[aria-current]::before {\n  color: inherit;\n}",
  "features": [
    "transitions",
    "Flexbox"
  ],
  "customProperties": []
}
