Skip to content

Swatch Grid

A copy-paste color pickers component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.

Color PickersHTMLCSSany framework

Copy into your project

HTML
<div class="nuda-swatches">
  <button class="nuda-swatches__chip" style="background:#ff5e7a"></button>
  <button class="nuda-swatches__chip" style="background:#ffb45e"></button>
  <button class="nuda-swatches__chip is-active" style="background:#e4ff54"></button>
  <!-- More swatches -->
</div>
CSS
.nuda-swatches {
  display: grid;
  grid-template-columns: repeat(8,1fr);
  gap: 6px;
  padding: 10px;
  background: rgba(255,255,255,.02);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 12px;
}

.nuda-swatches__chip {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  border: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1),box-shadow .2s;
  animation: _swPop .4s cubic-bezier(.16,1,.3,1) both;
}

.nuda-swatches__chip:hover {
  transform: scale(1.18) rotate(-6deg);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.2),0 4px 12px -4px rgba(0,0,0,.4);
}

.nuda-swatches__chip.is-active {
  transform: scale(1.1);
  box-shadow: inset 0 0 0 2px #fafafa,0 0 0 2px #e4ff54;
}

@keyframes _swPop {
  from {
    opacity: 0;
    transform: scale(.6);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-swatches__chip {
    animation: none;
  }
}

How to use Swatch Grid

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.

More color pickers components

← Browse all NudaUI components