Skip to content

Recording Timer

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

IndicatorsHTMLJavaScriptCSSany framework
REC00:07

Copy into your project

HTML
<div class="nuda-in2-rectimer" role="status" aria-live="polite">
  <span class="nuda-in2-rectimer__dot" aria-hidden="true"></span>
  <span class="nuda-in2-rectimer__label">REC</span>
  <span class="nuda-in2-rectimer__time">00:00</span>
</div>
JavaScript
/* Recording Timer — vanilla JS
   Counts elapsed mm:ss. The accessible name is refreshed
   every 10s so screen readers get progress without being spammed. */

(function () {
  document.querySelectorAll(".nuda-in2-rectimer").forEach(function (el) {
    var time = el.querySelector(".nuda-in2-rectimer__time");
    var seconds = 0;
    function fmt(s) {
      var m = Math.floor(s / 60);
      var r = s % 60;
      return String(m).padStart(2, "0") + ":" + String(r).padStart(2, "0");
    }
    el.setAttribute("aria-label", "Recording, " + fmt(seconds) + " elapsed");
    setInterval(function () {
      seconds++;
      time.textContent = fmt(seconds);
      if (seconds % 10 === 0) {
        el.setAttribute("aria-label", "Recording, " + fmt(seconds) + " elapsed");
      }
    }, 1000);
  });
})();
CSS
.nuda-in2-rectimer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: #161616;
  border: 1px solid rgba(239,68,68,.35);
  border-radius: 99px;
  font-family: ui-monospace,SFMono-Regular,Menlo,monospace;
  font-size: 11px;
  color: #cfcfcf;
  font-variant-numeric: tabular-nums;
}

.nuda-in2-rectimer__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
  animation: _nuda-in2rectimer-blink 1.6s ease-in-out infinite;
}

.nuda-in2-rectimer__label {
  font-weight: 700;
  letter-spacing: .06em;
  color: #ef4444;
}

.nuda-in2-rectimer__time {
  color: #fafafa;
}

@keyframes _nuda-in2rectimer-blink {
  0%,100% {
    opacity: 1;
  }
  50% {
    opacity: .35;
  }
}

@media (prefers-reduced-motion:reduce) {
  .nuda-in2-rectimer__dot {
    animation: none !important;
    opacity: 1;
  }
}

How to use Recording Timer

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 indicators components

← Browse all NudaUI components