Cancel Upload Button
A copy-paste file upload component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
File UploadHTMLCSSany framework
48% · cancel
Copy into your project
HTML
<div class="nuda-cancel">
<div class="nuda-cancel__progress" role="progressbar"
aria-valuenow="48" aria-valuemin="0" aria-valuemax="100">
<svg viewBox="0 0 36 36" aria-hidden="true">
<circle class="nuda-cancel__track" cx="18" cy="18" r="15" fill="none" />
<circle class="nuda-cancel__fill" cx="18" cy="18" r="15" fill="none" />
</svg>
<button class="nuda-cancel__btn" type="button" aria-label="Cancel upload">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor"
stroke-width="2.5" aria-hidden="true">
<path d="M6 6l12 12M18 6l-12 12" stroke-linecap="round" />
</svg>
</button>
</div>
<span class="nuda-cancel__label">48% · cancel</span>
</div>CSS
/* Cancel Upload Button
Ring-progress around an X that halts upload on click.
Update stroke-dashoffset = circumference * (1 - progress).
Circumference at r=15 is ~94.25. */
.nuda-cancel {
display: inline-flex;
align-items: center;
gap: 0.6rem;
}
.nuda-cancel__progress {
position: relative;
width: 40px;
height: 40px;
}
.nuda-cancel__progress svg {
width: 100%;
height: 100%;
transform: rotate(-90deg);
}
.nuda-cancel__track {
stroke: rgba(255, 255, 255, 0.08);
stroke-width: 3;
}
.nuda-cancel__fill {
stroke: #e4ff54;
stroke-width: 3;
stroke-linecap: round;
stroke-dasharray: 94.25;
stroke-dashoffset: 49;
transition: stroke-dashoffset 0.3s ease;
}
.nuda-cancel__btn {
position: absolute;
inset: 0;
display: flex;
align-items: center;
justify-content: center;
background: transparent;
border: none;
color: #fafafa;
cursor: pointer;
padding: 0;
border-radius: 50%;
transition: background 0.15s, color 0.15s;
}
.nuda-cancel__btn:hover {
background: rgba(255, 94, 122, 0.12);
color: #ff5e7a;
}
.nuda-cancel__btn svg { width: 14px; height: 14px; }
.nuda-cancel__label {
font-size: 0.78rem;
color: #a0a0a8;
font-variant-numeric: tabular-nums;
}
@media (prefers-reduced-motion: reduce) {
.nuda-cancel__fill,
.nuda-cancel__btn { transition: none; }
}How to use Cancel Upload Button
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.