Image Thumbnail Preview
A copy-paste file upload component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
File UploadHTMLCSSany framework
cover.jpg
Copy into your project
HTML
<div class="nuda-thumb" role="group" aria-label="Uploaded image preview">
<div class="nuda-thumb__img" aria-hidden="true">
<img src="/your-image.jpg" alt="" />
</div>
<button class="nuda-thumb__remove" type="button" aria-label="Remove image">
<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>
<p class="nuda-thumb__name">cover.jpg</p>
</div>CSS
/* Image Thumbnail Preview
Square preview with a floating remove badge. */
.nuda-thumb {
position: relative;
display: flex;
flex-direction: column;
gap: 0.4rem;
width: 120px;
}
.nuda-thumb__img {
position: relative;
width: 120px;
height: 120px;
border-radius: 10px;
overflow: hidden;
background: #111114;
border: 1px solid rgba(255, 255, 255, 0.08);
}
.nuda-thumb__img img,
.nuda-thumb__img svg {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
}
.nuda-thumb__remove {
position: absolute;
top: 6px;
right: 6px;
width: 22px;
height: 22px;
display: flex;
align-items: center;
justify-content: center;
background: #09090b;
border: 1px solid rgba(255, 255, 255, 0.1);
border-radius: 50%;
color: #fafafa;
cursor: pointer;
padding: 0;
transition: background 0.15s, border-color 0.15s;
}
.nuda-thumb__remove:hover {
background: #ff5e7a;
border-color: #ff5e7a;
}
.nuda-thumb__remove svg { width: 11px; height: 11px; }
.nuda-thumb__name {
margin: 0;
font-size: 0.75rem;
color: #a0a0a8;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
@media (prefers-reduced-motion: reduce) {
.nuda-thumb__remove { transition: none; }
}How to use Image Thumbnail Preview
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.