Drawer Toggle Nav
Hamburger button that morphs into a close icon while sliding a navigation drawer in from the left, driven entirely by a checkbox.
- lines of CSS
- 58lines of CSS
- dependencies
- 0dependencies
- browser, for years
- Everybrowser, for years
- motion only on interaction
- Hovermotion only on interaction
Vue, Svelte, styled-components and Tailwind exports are part of Pro. HTML, CSS and React are free forever.
.fx-v13-nav-drawer-15404 {
position: relative;
width: 236px;
height: 150px;
background: #0f172a;
border: 1px solid #1e293b;
border-radius: 0.7rem;
overflow: hidden;
}
.fx-v13-nav-drawer-15404 input { position: absolute; opacity: 0; pointer-events: none; }
.fx-v13-nav-drawer-15404 label {
position: absolute;
top: 0.6rem;
left: 0.6rem;
z-index: 2;
display: grid;
gap: 4px;
width: 30px;
padding: 7px 5px;
background: #1e293b;
border-radius: 0.4rem;
cursor: pointer;
}
.fx-v13-nav-drawer-15404 label i {
display: block;
height: 2px;
background: #e2e8f0;
border-radius: 2px;
transition: transform 0.3s ease, opacity 0.2s ease;
}
.fx-v13-nav-drawer-15404 nav {
position: absolute;
top: 0;
bottom: 0;
left: 0;
width: 130px;
display: grid;
align-content: start;
gap: 0.1rem;
padding: 3rem 0.5rem 0.5rem;
background: #16213a;
border-right: 1px solid #253049;
transform: translateX(-100%);
transition: transform 0.36s cubic-bezier(0.4, 0, 0.2, 1);
}
.fx-v13-nav-drawer-15404 nav a {
padding: 0.35rem 0.5rem;
font-size: 0.76rem;
color: #94a3b8;
border-radius: 0.35rem;
cursor: pointer;
transition: background 0.18s ease, color 0.18s ease;
}
.fx-v13-nav-drawer-15404 nav a:hover { background: #1e293b; color: #f1f5f9; }
.fx-v13-nav-drawer-15404 input:checked ~ nav { transform: translateX(0); }
.fx-v13-nav-drawer-15404 input:checked ~ label i:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.fx-v13-nav-drawer-15404 input:checked ~ label i:nth-child(2) { opacity: 0; }
.fx-v13-nav-drawer-15404 input:checked ~ label i:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }<div class="fx-v13-nav-drawer-15404">
<input type="checkbox" id="fx-v13-nav-drawer-15404-t" />
<label for="fx-v13-nav-drawer-15404-t">
<i></i>
<i></i>
<i></i>
</label>
<nav>
<a>Overview</a>
<a>Effects</a>
<a>Blocks</a>
<a>Pricing</a>
</nav>
</div>What do I do with this?
- Put
drawer-toggle-nav-15405.cssanywhere your page already loads CSS from — in Next.js that isapp/globals.css, or any stylesheet with a<link>in your HTML. - Then put the class on the element you want it on:
<button class="fx-v13-nav-drawer-15404">. The CSS does nothing until a class name in it matches something on the page.
- Link the stylesheet, then paste the markup wherever you need it.
npx hoverlab add drawer-toggle-nav-15405What's included
- The markup and the stylesheet, in whichever framework you pick
- No runtime dependencies
Works with
- React
- Vue
- Svelte
- Tailwind
- styled-components
- Plain CSS
npx hoverlab add drawer-toggle-nav-15405
Or over MCP, from your editor's agent — no account needed.
License
Free to read, copy and install, for personal and non-commercial projects. Shipping it in client work or a paid product needs Pro ($79 once). The source lands in your repo and stops being ours — no attribution, nothing to upgrade.
Motion safety
Static estimate, read from the CSS
- Reduced motion
- Brief motion, no guard
Animates briefly or on interaction. Only looping motion gets a guard in this catalog; copy the one from the Insights tab if this ships on a critical path.
- What it animates
- Repaints
Animates
background,color. No reflow, but the browser repaints every frame, which is fine for one element and costly across many. - Flashing (WCAG 2.3.1)
- No flashing found
No repeating change in opacity, colour or brightness large enough to count as a flash.
- Layout shift (CLS)
- No shift expected
Nothing it animates moves or resizes the box in flow. A category from the CSS, not a measurement for this effect.
Every row is read from the shipped CSS. Only a figure marked measured came from a browser. Customizing the speed changes the timing, so recheck a customized copy. How it is computed
33 more effects in Navigation & Menus
All of them free to read, copy and install — no account, no locked tiles, no watermarked preview. The whole catalog is open, and so are the API and the CLI.
Browse Navigation & MenusShipping one commercially
Copying the code is free. Putting it in client work or a paid product is what Pro is for — the licence, not the access.
- A commercial licence for everything in the catalog
- Unlimited bundle exports, in Vue, Svelte and Tailwind
- One payment — no subscription, nothing to renew
7 variations of Drawer Toggle Nav
Finished looks, each one a position in the customizer above. Copy any of them, or open it and keep moving the sliders.