CSS Grouped Sidebar Menu
An app sidebar with labelled sections, count badges and a clear active item, using real lists.
<nav class="group-nav" aria-label="App">
<p class="group-nav-label" id="group-nav-mail">Mail</p>
<ul aria-labelledby="group-nav-mail">
<li><a href="#" aria-current="page">Inbox <span>12</span></a></li>
<li><a href="#">Drafts <span>3</span></a></li>
</ul>
<p class="group-nav-label" id="group-nav-labels">Labels</p>
<ul aria-labelledby="group-nav-labels">
<li><a href="#">Clients</a></li>
</ul>
</nav>
.group-nav {
width: 200px;
padding: 10px;
border-radius: 14px;
background: #ffffff;
box-shadow: 0 1px 3px #0f172a14;
font: 500 14px/1.3 system-ui, sans-serif;
}
.group-nav-label {
margin: 10px 10px 2px;
color: #64748b;
font-size: 11px;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
.group-nav-label:first-child {
margin-top: 2px;
}
.group-nav ul {
margin: 0;
padding: 0;
list-style: none;
}
.group-nav a {
display: flex;
align-items: center;
justify-content: space-between;
padding: 7px 10px;
border-radius: 8px;
color: #334155;
text-decoration: none;
}
.group-nav a:hover {
background: #f1f5f9;
}
.group-nav a[aria-current="page"] {
background: #fff7ed;
color: #c2410c;
font-weight: 600;
}
.group-nav a span {
min-width: 20px;
padding: 2px 6px;
border-radius: 999px;
background: #e2e8f0;
color: #475569;
font-size: 12px;
text-align: center;
}
.group-nav a[aria-current="page"] span {
background: #ea580c;
color: #ffffff;
}
.group-nav a:focus-visible {
outline: 2px solid #ea580c;
outline-offset: -2px;
}
About this CSS Grouped Sidebar Menu
This CSS Grouped Sidebar Menu is 67 lines of pure CSS (1.1 KB) with no JavaScript and no dependencies. It uses box shadows, Flexbox and keyboard focus styles. It works in current versions of Chrome, Edge, Safari and Firefox. It works in any stack: plain HTML, React, Vue, Svelte, Astro, WordPress or Webflow.
CSS features used
Customize it
The colors in this snippet. Search and replace them to match your brand:
#ffffff#0f172a14#64748b#334155#f1f5f9#fff7ed#c2410c#e2e8f0#475569#ea580c
How to use this grouped sidebar menu
- Copy the HTML and paste it where you want the element to appear.
- Copy the CSS into your stylesheet, or inside a
<style>tag. - Keep the
.group-navclass name, or rename it in both places. Then tweak colors, sizes and timing to match your design. - Using React or Next.js? Change
classtoclassNamein the HTML. The CSS works as is, including in Tailwind projects (put it in your global stylesheet).
Building with an AI tool?
“Copy for AI” copies a short prompt for Cursor, Claude Code, Lovable, Bolt or v0. Your AI tool opens the Markdown version of this snippet and reads the HTML, CSS and setup notes there. If your tool can't open links, with the code instead. More ways to use copy CSS with AI.