Captions Toggle
A copy-paste video player ui component in pure HTML & CSS. Zero dependencies, framework-agnostic, MIT-licensed.
Video Player UIHTMLCSSany framework
Copy into your project
HTML
<!-- Captions Toggle — toggle .is-active to show CC enabled -->
<button class="nuda-cc" type="button" aria-label="Captions">
<span class="nuda-cc__box">CC</span>
<span class="nuda-cc__line"></span>
</button>CSS
/* Captions Toggle
"CC" badge with an underline that draws when active.
Customize: --cc-accent */
.nuda-cc {
--cc-accent: #e4ff54;
position: relative;
display: inline-flex;
align-items: center;
justify-content: center;
padding: 7px 12px;
background: transparent;
border: none;
color: #fafafa;
cursor: pointer;
transition: color 0.2s;
}
.nuda-cc:hover { color: var(--cc-accent); }
.nuda-cc__box {
font: 800 0.75rem ui-sans-serif, system-ui, sans-serif;
letter-spacing: 0.04em;
padding: 3px 6px;
border: 1.5px solid currentColor;
border-radius: 4px;
line-height: 1;
}
.nuda-cc.is-active { color: var(--cc-accent); }
.nuda-cc.is-active .nuda-cc__box {
background: rgba(228, 255, 84, 0.15);
box-shadow: 0 0 4px rgba(228, 255, 84, 0.3);
}
.nuda-cc__line {
position: absolute;
left: 50%;
bottom: -2px;
width: 0;
height: 2px;
background: var(--cc-accent);
border-radius: 1px;
transform: translateX(-50%);
transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.nuda-cc.is-active .nuda-cc__line {
width: 60%;
box-shadow: 0 0 4px rgba(228, 255, 84, 0.5);
}How to use Captions Toggle
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.