Skip to content

Usage Slider Pricing

A copy-paste pricing tables component in pure HTML, CSS & vanilla JS. Zero dependencies, framework-agnostic, MIT-licensed.

Pricing TablesHTMLJavaScriptCSSany framework
Seats10
$100/mo

Copy into your project

HTML
<!-- Usage Slider Pricing — drag seats, price recalculates -->
<div class="nuda-pr2-usage-slider">
  <div class="nuda-pr2-usage-slider__head">
    <span class="nuda-pr2-usage-slider__label">Seats</span>
    <span class="nuda-pr2-usage-slider__count">10</span>
  </div>
  <input class="nuda-pr2-usage-slider__range" type="range" min="1" max="50" value="10" aria-label="Number of seats" />
  <div class="nuda-pr2-usage-slider__price">
    <b>$100</b><i>/mo</i>
  </div>
</div>
JavaScript
/* Usage Slider Pricing — recomputes price on drag. */

(function () {
  var root = document.querySelector('.nuda-pr2-usage-slider');
  if (!root) return;
  var range = root.querySelector('.nuda-pr2-usage-slider__range');
  var count = root.querySelector('.nuda-pr2-usage-slider__count');
  var priceEl = root.querySelector('.nuda-pr2-usage-slider__price');
  var priceB = priceEl.querySelector('b');
  var perSeat = 10;

  range.addEventListener('input', function () {
    var seats = Number(range.value);
    count.textContent = seats;
    priceB.textContent = '$' + (seats * perSeat);
    priceEl.classList.remove('is-updated');
    void priceEl.offsetWidth; // restart animation
    priceEl.classList.add('is-updated');
  });
})();
CSS
.nuda-pr2-usage-slider {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  width: 180px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px;
}

.nuda-pr2-usage-slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.nuda-pr2-usage-slider__label {
  font: 600 9px ui-sans-serif,system-ui;
  color: #a1a1aa;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.nuda-pr2-usage-slider__count {
  font: 800 13px ui-sans-serif,system-ui;
  color: #e4ff54;
  font-variant-numeric: tabular-nums;
}

.nuda-pr2-usage-slider__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 24px;
  background: transparent;
  cursor: pointer;
  outline-offset: 4px;
}

.nuda-pr2-usage-slider__range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
}

.nuda-pr2-usage-slider__range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,.1);
}

.nuda-pr2-usage-slider__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  margin-top: -6px;
  border-radius: 50%;
  background: #e4ff54;
  border: 2px solid #09090b;
  box-shadow: 0 0 0 1px rgba(228,255,84,.4);
  cursor: pointer;
  transition: transform .2s;
}

.nuda-pr2-usage-slider__range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.nuda-pr2-usage-slider__range::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #e4ff54;
  border: 2px solid #09090b;
  cursor: pointer;
}

.nuda-pr2-usage-slider__range:focus-visible {
  outline: 2px solid #e4ff54;
}

.nuda-pr2-usage-slider__price {
  display: flex;
  align-items: baseline;
  gap: 2px;
}

.nuda-pr2-usage-slider__price b {
  font: 800 22px ui-sans-serif,system-ui;
  color: #fafafa;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.nuda-pr2-usage-slider__price i {
  font: 500 10px ui-sans-serif,system-ui;
  font-style: normal;
  color: #63636e;
}

.nuda-pr2-usage-slider__price.is-updated b {
  animation: nuda-pr2-usage-slider-pop .35s ease;
}

@keyframes nuda-pr2-usage-slider-pop {
  0% {
    transform: scale(1.15);
    filter: drop-shadow(0 0 8px rgba(228,255,84,.6));
  }
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(228,255,84,0));
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-pr2-usage-slider__price.is-updated b {
    animation: none !important;
  }
  .nuda-pr2-usage-slider__range::-webkit-slider-thumb {
    transition: none;
  }
}

How to use Usage Slider Pricing

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 pricing tables components

← Browse all NudaUI components