TOTP Ring Timer
A copy-paste login & auth component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Login & AuthHTMLCSSany framework
Two-factor codeRefreshes every 30s
Copy into your project
HTML
<div class="nuda-au2-totp-ring">
<div class="nuda-au2-totp-ring__head">
<svg class="nuda-au2-totp-ring__ring" aria-hidden="true" viewBox="0 0 44 44">
<circle class="nuda-au2-totp-ring__track" cx="22" cy="22" r="19"></circle>
<circle class="nuda-au2-totp-ring__prog" cx="22" cy="22" r="19"></circle>
</svg>
<div class="nuda-au2-totp-ring__label">
<span class="nuda-au2-totp-ring__title">Two-factor code</span>
<span class="nuda-au2-totp-ring__sub">Refreshes every 30s</span>
</div>
</div>
<form class="nuda-au2-totp-ring__form">
<label class="nuda-au2-totp-ring__fieldlabel" for="au2-totp-code">6-digit code</label>
<input id="au2-totp-code" class="nuda-au2-totp-ring__input" type="text" inputmode="numeric" pattern="[0-9]*" autocomplete="one-time-code" maxlength="6" placeholder="••••••" required />
<button class="nuda-au2-totp-ring__cta" type="submit">Verify</button>
</form>
</div>CSS
.nuda-au2-totp-ring {
display: flex;
flex-direction: column;
gap: 14px;
padding: 22px;
width: 100%;
max-width: 280px;
background: #0a0a0a;
border: 1px solid rgba(255,255,255,.08);
border-radius: 16px;
}
.nuda-au2-totp-ring__head {
display: flex;
align-items: center;
gap: 12px;
}
.nuda-au2-totp-ring__ring {
width: 44px;
height: 44px;
flex: 0 0 auto;
transform: rotate(-90deg);
}
.nuda-au2-totp-ring__track {
fill: none;
stroke: rgba(255,255,255,.1);
stroke-width: 3;
}
.nuda-au2-totp-ring__prog {
fill: none;
stroke: #e4ff54;
stroke-width: 3;
stroke-linecap: round;
stroke-dasharray: 119.4;
stroke-dashoffset: 0;
animation: nuda-au2-totp-ring-drain 30s linear infinite;
will-change: stroke-dashoffset;
}
.nuda-au2-totp-ring__label {
display: flex;
flex-direction: column;
gap: 2px;
min-width: 0;
}
.nuda-au2-totp-ring__title {
color: #fafafa;
font-size: 13px;
font-weight: 600;
}
.nuda-au2-totp-ring__sub {
color: #777;
font-size: 11px;
}
.nuda-au2-totp-ring__form {
display: flex;
flex-direction: column;
gap: 10px;
}
.nuda-au2-totp-ring__fieldlabel {
color: #cfcfcf;
font-size: 11px;
}
.nuda-au2-totp-ring__input {
width: 100%;
box-sizing: border-box;
padding: 12px;
background: rgba(255,255,255,.03);
border: 1px solid rgba(255,255,255,.1);
border-radius: 10px;
color: #fafafa;
font-size: 16px;
letter-spacing: .35em;
text-align: center;
outline: none;
transition: border-color .2s,box-shadow .2s;
}
.nuda-au2-totp-ring__input:focus-visible {
border-color: #e4ff54;
box-shadow: 0 0 0 3px rgba(228,255,84,.15);
}
.nuda-au2-totp-ring__cta {
min-height: 44px;
padding: 10px;
background: #e4ff54;
color: #0a0a0a;
border: 0;
border-radius: 10px;
font-size: 13px;
font-weight: 600;
cursor: pointer;
transition: filter .2s,transform .15s;
}
.nuda-au2-totp-ring__cta:hover {
filter: brightness(1.08);
transform: translateY(-1px);
}
.nuda-au2-totp-ring__cta:focus-visible {
outline: 2px solid #e4ff54;
outline-offset: 2px;
}
@keyframes nuda-au2-totp-ring-drain {
0% {
stroke-dashoffset: 0;
}
100% {
stroke-dashoffset: 119.4;
}
}
@media (prefers-reduced-motion:reduce) {
.nuda-au2-totp-ring__prog {
animation: none;
stroke-dashoffset: 40;
}
}
How to use TOTP Ring 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.