Fade Dropdown
A copy-paste dropdowns & menus component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Dropdowns & MenusHTMLCSSany framework
Copy into your project
HTML
<div class="nuda-ddf">
<button class="nuda-ddf__trigger">Menu ▾</button>
<ul class="nuda-ddf__menu">
<li class="nuda-ddf__item">Profile</li>
<li class="nuda-ddf__item">Settings</li>
<li class="nuda-ddf__item">Sign out</li>
</ul>
</div>CSS
.nuda-ddf {
position: relative;
display: inline-block;
font-family: inherit;
}
.nuda-ddf__trigger {
background: #1a1a1a;
color: #fafafa;
border: 1px solid rgba(255,255,255,.1);
border-radius: 8px;
padding: .5rem .9rem;
font-size: .8rem;
cursor: pointer;
}
.nuda-ddf__menu {
list-style: none;
margin: .4rem 0 0;
padding: .35rem;
min-width: 160px;
background: #141414;
border: 1px solid rgba(255,255,255,.1);
border-radius: 10px;
box-shadow: 0 12px 30px -12px rgba(0,0,0,.6);
animation: _ddfIn .2s ease-out;
}
.nuda-ddf__item {
padding: .5rem .6rem;
border-radius: 6px;
font-size: .8rem;
color: #cfcfcf;
cursor: pointer;
transition: background .15s,color .15s;
}
.nuda-ddf__item:hover {
background: rgba(228,255,84,.1);
color: #fafafa;
}
@keyframes _ddfIn {
from {
opacity: 0;
transform: translateY(-4px);
}
to {
opacity: 1;
transform: none;
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-ddf__menu {
animation: none;
}
}
How to use Fade Dropdown
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.