Radio Group Menu
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-dm2-radio">
<button class="nuda-dm2-radio__trigger" type="button" aria-haspopup="menu" aria-expanded="true">View: Grid ▾</button>
<div class="nuda-dm2-radio__menu" role="menu" aria-label="View">
<div class="nuda-dm2-radio__group" role="group" aria-label="View mode">
<button class="nuda-dm2-radio__item" type="button" role="menuitemradio" aria-checked="false">
<span class="nuda-dm2-radio__dot" aria-hidden="true"></span>
List
</button>
<button class="nuda-dm2-radio__item nuda-dm2-radio__item--checked" type="button" role="menuitemradio" aria-checked="true">
<span class="nuda-dm2-radio__dot" aria-hidden="true"></span>
Grid
</button>
<button class="nuda-dm2-radio__item" type="button" role="menuitemradio" aria-checked="false">
<span class="nuda-dm2-radio__dot" aria-hidden="true"></span>
Board
</button>
</div>
</div>
</div>CSS
.nuda-dm2-radio {
position: relative;
display: inline-block;
font-family: inherit;
transform-origin: top left;
}
.nuda-dm2-radio__trigger {
background: #1a1a1a;
color: #fafafa;
border: 1px solid rgba(255,255,255,.12);
border-radius: 8px;
padding: .55rem .9rem;
font-size: .8rem;
cursor: pointer;
min-height: 44px;
}
.nuda-dm2-radio__trigger:focus-visible {
outline: 2px solid #e4ff54;
outline-offset: 2px;
}
.nuda-dm2-radio__menu {
margin: .4rem 0 0;
padding: .35rem;
width: 180px;
background: #141414;
border: 1px solid rgba(255,255,255,.1);
border-radius: 10px;
transform-origin: top left;
animation: _nuda-dm2radioIn .2s ease-out;
}
.nuda-dm2-radio__item {
display: flex;
align-items: center;
gap: .6rem;
width: 100%;
box-sizing: border-box;
min-height: 44px;
padding: .5rem .65rem;
border: 0;
background: transparent;
border-radius: 6px;
font-size: .8rem;
color: #cfcfcf;
text-align: left;
cursor: pointer;
transition: background .15s ease,color .15s ease;
}
.nuda-dm2-radio__item:hover,.nuda-dm2-radio__item:focus-visible {
background: rgba(255,255,255,.06);
color: #fafafa;
}
.nuda-dm2-radio__item:focus-visible {
outline: 2px solid #e4ff54;
outline-offset: -2px;
}
.nuda-dm2-radio__dot {
flex: 0 0 auto;
width: 14px;
height: 14px;
border-radius: 50%;
border: 1.5px solid rgba(255,255,255,.25);
box-sizing: border-box;
}
.nuda-dm2-radio__item--checked {
color: #e4ff54;
}
.nuda-dm2-radio__item--checked .nuda-dm2-radio__dot {
border-color: #e4ff54;
background: radial-gradient(circle,#e4ff54 0 40%,transparent 42%);
}
@keyframes _nuda-dm2radioIn {
from {
opacity: 0;
transform: translateY(-6px) scale(.98);
}
to {
opacity: 1;
transform: none;
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-dm2-radio__menu {
animation: none !important;
}
}
How to use Radio Group Menu
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.