44 / 51
All 51 in 51 Tailwind CSS Buttons
- 01Tailwind Submit Button (Form Primary)
- 02Tailwind Primary and Secondary Button Pair
- 03Tailwind Ghost / Outline Button
- 04Tailwind Icon-Only Button with Accessible Tooltip
- 05Tailwind Gradient CTA Button
- 06Tailwind Loading Spinner Button (State Transition)
- 07Tailwind Disabled Button State (Full State Reference)
- 08Tailwind Button Group Component (Segmented Radio-Like)
- 09Tailwind Add to Cart Button
- 10Tailwind Download Progress Button
- 11Tailwind Like Heart Button
- 12Tailwind Confirm Delete Button
- 13Tailwind Play Pause Button
- 14Tailwind Subscribe Confetti Button
- 15Tailwind Magnetic Mercury Ripple Button
- 16Tailwind Brutalist Glitch Button
- 17Tailwind Neon Plasma Burst Button
- 18Tailwind Clay Press Button
- 19Tailwind Editorial Ink Spread Button
- 20Tailwind Particle Shard Burst Button
- 21Tailwind Brushed Brass Plate Button
- 22Tailwind Washi Paper Crane Button
- 23Tailwind Frosted Ice Cube Button
- 24Tailwind Vintage Typewriter Key Button
- 25Tailwind Lacquered Walnut Wood Button
- 26Tailwind Pharma Gel Capsule Button
- 27Tailwind Aged Copper Coin Button
- 28Tailwind Origami Fortune Cookie Button
- 29Tailwind Holographic Foil Sticker Button
- 30Tailwind Brutalist Concrete Slab Button
- 31Tailwind Mercury Bead Morph Button
- 32Tailwind Soft Pill Modern SaaS Button
- 33Tailwind Masking Tape Label Button
- 34Tailwind Obsidian Glass Shard Button
- 35Tailwind Wine Velvet Ribbon Button
- 36Tailwind LED Segment Display Button
- 37Tailwind Cassette Mixtape Label Button
- 38Tailwind Chalkboard Menu Button
- 39Tailwind Vinyl Record Sleeve Ripple Button
- 40Tailwind Polaroid Snapshot Button
- 41Tailwind Airline Boarding Pass Button
- 42Tailwind Aged Brass Subway Token Button
- 43Tailwind Vintage Rx Pharmacy Label Button
- 44Tailwind Bakelite Radio Dial Toggle Button
- 45Tailwind Regal Postage Stamp Button
- 46Tailwind Victorian Cigar Band Foil Button
- 47Tailwind Vintage Calculator Key Button
- 48Tailwind Toolbox Latch Spotlight Button
- 49Tailwind Receipt Paper Total Count-Up Button
- 50Tailwind IBM Punch Card Magnetic Follow Button
- 51Tailwind Brass Periscope Lens Button
Tailwind Bakelite Radio Dial Toggle Button
A bakelite rotary switch that turns 132° from OFF to ON, with a knurled grip, a chamfered pointer, engraved ticks around the bezel, and a warm indicator lamp that fades up as the contact closes. A checkbox with role="switch" holds the state.
Untitled UI Pro: 5,000+ React + Tailwind CSS v4 components · from $349 one-time
Untitled UI React · Affiliate link
The code
<div class="tb-44 w-full min-h-svh grid place-items-center font-tb44-sans p-[clamp(1.5rem,6vw,4rem)]">
<label class="group relative block cursor-pointer [-webkit-tap-highlight-color:transparent]">
<input type="checkbox" role="switch" aria-label="Power" class="sr-only">
<span aria-hidden="true" class="tb-44__plate relative grid place-items-center size-38 rounded-full shadow-[inset_0_2px_4px_#ffffff1a,inset_0_-3px_8px_#000000b3,0_16px_26px_-12px_#000000d9] group-has-focus-visible:outline-2 group-has-focus-visible:outline-offset-[5px] group-has-focus-visible:outline-tb44-lamp">
<span class="absolute inset-0 rounded-full opacity-65 bg-[repeating-conic-gradient(from_-66deg,var(--color-tb44-tick)_0_0.9deg,transparent_0.9deg_11deg)] [mask-image:radial-gradient(farthest-side,transparent_76%,#000_78%)]"></span>
<span class="absolute left-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-100 -rotate-[24deg] transition-opacity duration-300 group-has-checked:opacity-60 motion-reduce:transition-none">Off</span>
<span class="absolute right-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-60 rotate-[24deg] transition-[opacity,color] duration-300 group-has-checked:opacity-100 group-has-checked:text-tb44-lamp motion-reduce:transition-none">On</span>
<span class="absolute top-3.5 size-2 rounded-full bg-tb44-lamp opacity-[0.18] shadow-[0_0_6px_var(--color-tb44-lamp),0_0_14px_var(--color-tb44-lamp-55)] transition-opacity duration-[350ms] group-has-checked:opacity-100 motion-reduce:transition-none"></span>
<span class="tb-44__knob relative w-[62%] h-[62%] rounded-full -rotate-[66deg] shadow-[inset_0_2px_3px_#ffffff38,inset_0_-3px_6px_#00000099,0_6px_12px_-4px_#000000cc] transition-[rotate,filter] duration-700 ease-tb44-spring group-hover:brightness-110 group-active:scale-[0.97] group-has-checked:rotate-[66deg] motion-reduce:transition-none">
<span class="absolute inset-0 rounded-full bg-[repeating-conic-gradient(from_0deg,#ffffff24_0_1.6deg,#00000038_1.6deg_3.4deg)] [mask-image:radial-gradient(farthest-side,transparent_78%,#000_80%)]"></span>
<span class="absolute top-[9%] left-1/2 w-[0.28rem] h-[34%] -ml-[0.14rem] rounded-full bg-[linear-gradient(180deg,var(--color-tb44-tick),var(--color-tb44-tick-lo))] shadow-[0_0_4px_#00000099]"></span>
</span>
</span>
</label>
</div><div class="tb-44 w-full min-h-svh grid place-items-center font-tb44-sans p-[clamp(1.5rem,6vw,4rem)]">
<label class="group relative block cursor-pointer [-webkit-tap-highlight-color:transparent]">
<input type="checkbox" role="switch" aria-label="Power" class="sr-only">
<span aria-hidden="true" class="tb-44__plate relative grid place-items-center size-38 rounded-full shadow-[inset_0_2px_4px_#ffffff1a,inset_0_-3px_8px_#000000b3,0_16px_26px_-12px_#000000d9] group-has-focus-visible:outline-2 group-has-focus-visible:outline-offset-[5px] group-has-focus-visible:outline-tb44-lamp">
<span class="absolute inset-0 rounded-full opacity-65 bg-[repeating-conic-gradient(from_-66deg,var(--color-tb44-tick)_0_0.9deg,transparent_0.9deg_11deg)] [mask-image:radial-gradient(farthest-side,transparent_76%,#000_78%)]"></span>
<span class="absolute left-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-100 -rotate-[24deg] transition-opacity duration-300 group-has-checked:opacity-60 motion-reduce:transition-none">Off</span>
<span class="absolute right-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-60 rotate-[24deg] transition-[opacity,color] duration-300 group-has-checked:opacity-100 group-has-checked:text-tb44-lamp motion-reduce:transition-none">On</span>
<span class="absolute top-3.5 size-2 rounded-full bg-tb44-lamp opacity-[0.18] shadow-[0_0_6px_var(--color-tb44-lamp),0_0_14px_var(--color-tb44-lamp-55)] transition-opacity duration-[350ms] group-has-checked:opacity-100 motion-reduce:transition-none"></span>
<span class="tb-44__knob relative w-[62%] h-[62%] rounded-full -rotate-[66deg] shadow-[inset_0_2px_3px_#ffffff38,inset_0_-3px_6px_#00000099,0_6px_12px_-4px_#000000cc] transition-[rotate,filter] duration-700 ease-tb44-spring group-hover:brightness-110 group-active:scale-[0.97] group-has-checked:rotate-[66deg] motion-reduce:transition-none">
<span class="absolute inset-0 rounded-full bg-[repeating-conic-gradient(from_0deg,#ffffff24_0_1.6deg,#00000038_1.6deg_3.4deg)] [mask-image:radial-gradient(farthest-side,transparent_78%,#000_80%)]"></span>
<span class="absolute top-[9%] left-1/2 w-[0.28rem] h-[34%] -ml-[0.14rem] rounded-full bg-[linear-gradient(180deg,var(--color-tb44-tick),var(--color-tb44-tick-lo))] shadow-[0_0_4px_#00000099]"></span>
</span>
</span>
</label>
</div>@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}Setup — do this once per project
Skip this if your project already runs Tailwind v4.
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>Compiles in the browser — perfect for a CodePen or a quick test, not for production.
npm install tailwindcss @tailwindcss/vite
npm install tailwindcss @tailwindcss/vite// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})// vite.config.js ("type": "module" in package.json)
import { defineConfig } from 'vite'
import tailwindcss from '@tailwindcss/vite'
export default defineConfig({
plugins: [tailwindcss()],
})Any v4 setup works — Vite, PostCSS or the CLI. Nothing in this demo is bundler-specific.
@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}<link rel="preconnect" href="https://fonts.googleapis.com"> <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;600&display=swap">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Oswald:wght@500;600&display=swap">What changed in the port
Which parts became utilities, which stayed CSS, and why.
- Utilities: the rotation and its spring, both legends, the lamp, the tick ring, the knurl, the pointer, the focus ring on the plate. CSS: the plate and bakelite gradients, the
linear()spring, and the two-webkit-maskshims. - Splitting the 132° throw into
-rotate-[66deg]androtate-[66deg]is a small port improvement over the original's-66deg/132degpair: the symmetry with the tick ring'sfrom -66degis now visible, so the "pointer must land on a tick" constraint is self-documenting. role="switch"survives the port untouched, and that is the point — it is the single most important attribute on the control and no utility is involved in it.- A11y fix from the CSS original: the resting legends sat at
opacity:.6on--ink:#e6d7b8over the dark plate — about 3.9:1 for the active one, since both were dimmed until checked. The port keeps the inactive legend at 60% but holds the current one at full opacity in both states, so whichever legend is true is always ≈9:1.
Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Bakelite Radio Dial Toggle Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-bakelite-radio-dial-toggle-button/
A bakelite rotary switch that turns 132° from OFF to ON, with a knurled grip, a chamfered pointer, engraved ticks around the bezel, and a warm indicator lamp that fades up as the contact closes. A checkbox with role="switch" holds the state.
## HTML
```html
<div class="tb-44 w-full min-h-svh grid place-items-center font-tb44-sans p-[clamp(1.5rem,6vw,4rem)]">
<label class="group relative block cursor-pointer [-webkit-tap-highlight-color:transparent]">
<input type="checkbox" role="switch" aria-label="Power" class="sr-only">
<span aria-hidden="true" class="tb-44__plate relative grid place-items-center size-38 rounded-full shadow-[inset_0_2px_4px_#ffffff1a,inset_0_-3px_8px_#000000b3,0_16px_26px_-12px_#000000d9] group-has-focus-visible:outline-2 group-has-focus-visible:outline-offset-[5px] group-has-focus-visible:outline-tb44-lamp">
<span class="absolute inset-0 rounded-full opacity-65 bg-[repeating-conic-gradient(from_-66deg,var(--color-tb44-tick)_0_0.9deg,transparent_0.9deg_11deg)] [mask-image:radial-gradient(farthest-side,transparent_76%,#000_78%)]"></span>
<span class="absolute left-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-100 -rotate-[24deg] transition-opacity duration-300 group-has-checked:opacity-60 motion-reduce:transition-none">Off</span>
<span class="absolute right-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-60 rotate-[24deg] transition-[opacity,color] duration-300 group-has-checked:opacity-100 group-has-checked:text-tb44-lamp motion-reduce:transition-none">On</span>
<span class="absolute top-3.5 size-2 rounded-full bg-tb44-lamp opacity-[0.18] shadow-[0_0_6px_var(--color-tb44-lamp),0_0_14px_var(--color-tb44-lamp-55)] transition-opacity duration-[350ms] group-has-checked:opacity-100 motion-reduce:transition-none"></span>
<span class="tb-44__knob relative w-[62%] h-[62%] rounded-full -rotate-[66deg] shadow-[inset_0_2px_3px_#ffffff38,inset_0_-3px_6px_#00000099,0_6px_12px_-4px_#000000cc] transition-[rotate,filter] duration-700 ease-tb44-spring group-hover:brightness-110 group-active:scale-[0.97] group-has-checked:rotate-[66deg] motion-reduce:transition-none">
<span class="absolute inset-0 rounded-full bg-[repeating-conic-gradient(from_0deg,#ffffff24_0_1.6deg,#00000038_1.6deg_3.4deg)] [mask-image:radial-gradient(farthest-side,transparent_78%,#000_80%)]"></span>
<span class="absolute top-[9%] left-1/2 w-[0.28rem] h-[34%] -ml-[0.14rem] rounded-full bg-[linear-gradient(180deg,var(--color-tb44-tick),var(--color-tb44-tick-lo))] shadow-[0_0_4px_#00000099]"></span>
</span>
</span>
</label>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}
```Here's a working CSS demo from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Tailwind Bakelite Radio Dial Toggle Button
Source: https://codefronts.com/components/tailwind-css-buttons/tailwind-bakelite-radio-dial-toggle-button/
A bakelite rotary switch that turns 132° from OFF to ON, with a knurled grip, a chamfered pointer, engraved ticks around the bezel, and a warm indicator lamp that fades up as the contact closes. A checkbox with role="switch" holds the state.
## HTML
```html
<div class="tb-44 w-full min-h-svh grid place-items-center font-tb44-sans p-[clamp(1.5rem,6vw,4rem)]">
<label class="group relative block cursor-pointer [-webkit-tap-highlight-color:transparent]">
<input type="checkbox" role="switch" aria-label="Power" class="sr-only">
<span aria-hidden="true" class="tb-44__plate relative grid place-items-center size-38 rounded-full shadow-[inset_0_2px_4px_#ffffff1a,inset_0_-3px_8px_#000000b3,0_16px_26px_-12px_#000000d9] group-has-focus-visible:outline-2 group-has-focus-visible:outline-offset-[5px] group-has-focus-visible:outline-tb44-lamp">
<span class="absolute inset-0 rounded-full opacity-65 bg-[repeating-conic-gradient(from_-66deg,var(--color-tb44-tick)_0_0.9deg,transparent_0.9deg_11deg)] [mask-image:radial-gradient(farthest-side,transparent_76%,#000_78%)]"></span>
<span class="absolute left-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-100 -rotate-[24deg] transition-opacity duration-300 group-has-checked:opacity-60 motion-reduce:transition-none">Off</span>
<span class="absolute right-1.5 bottom-6 text-[0.6875rem] tracking-[0.16em] uppercase text-tb44-ink opacity-60 rotate-[24deg] transition-[opacity,color] duration-300 group-has-checked:opacity-100 group-has-checked:text-tb44-lamp motion-reduce:transition-none">On</span>
<span class="absolute top-3.5 size-2 rounded-full bg-tb44-lamp opacity-[0.18] shadow-[0_0_6px_var(--color-tb44-lamp),0_0_14px_var(--color-tb44-lamp-55)] transition-opacity duration-[350ms] group-has-checked:opacity-100 motion-reduce:transition-none"></span>
<span class="tb-44__knob relative w-[62%] h-[62%] rounded-full -rotate-[66deg] shadow-[inset_0_2px_3px_#ffffff38,inset_0_-3px_6px_#00000099,0_6px_12px_-4px_#000000cc] transition-[rotate,filter] duration-700 ease-tb44-spring group-hover:brightness-110 group-active:scale-[0.97] group-has-checked:rotate-[66deg] motion-reduce:transition-none">
<span class="absolute inset-0 rounded-full bg-[repeating-conic-gradient(from_0deg,#ffffff24_0_1.6deg,#00000038_1.6deg_3.4deg)] [mask-image:radial-gradient(farthest-side,transparent_78%,#000_80%)]"></span>
<span class="absolute top-[9%] left-1/2 w-[0.28rem] h-[34%] -ml-[0.14rem] rounded-full bg-[linear-gradient(180deg,var(--color-tb44-tick),var(--color-tb44-tick-lo))] shadow-[0_0_4px_#00000099]"></span>
</span>
</span>
</label>
</div>
```
## CSS
```css
@import "tailwindcss";
@theme {
--color-tb44-bg: #1b1512;
--color-tb44-bg: oklch(0.2 0.02 50);
--color-tb44-plate: #241c17;
--color-tb44-plate: oklch(0.24 0.025 50);
--color-tb44-bake: #3a2418;
--color-tb44-bake: oklch(0.3 0.05 50);
--color-tb44-bake-hi: #5a3a26;
--color-tb44-bake-hi: oklch(0.4 0.06 52);
--color-tb44-bake-lo: #1d120b;
--color-tb44-bake-lo: oklch(0.18 0.03 48);
--color-tb44-tick: #c9b48d;
--color-tb44-tick: oklch(0.78 0.04 82);
--color-tb44-tick-lo: #8a7a59;
--color-tb44-tick-lo: oklch(0.56 0.04 82);
--color-tb44-ink: #e6d7b8;
--color-tb44-ink: oklch(0.88 0.04 85);
--color-tb44-lamp: #ff9f43;
--color-tb44-lamp: oklch(0.78 0.16 62);
--color-tb44-lamp-55: #ff9f438c;
--color-tb44-lamp-55: oklch(0.78 0.16 62 / 0.55);
--font-tb44-sans: "Oswald", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--ease-tb44-spring: cubic-bezier(0.16, 1, 0.3, 1);
}
@supports (transition-timing-function: linear(0, 1)) {
@theme {
--ease-tb44-spring: linear(0, 0.36 7%, 0.8 15%, 1.05 23%, 1.09 29%, 1.02 39%, 1 54%, 1);
}
}
.tb-44 {
width: 100%;
min-height: 100vh;
min-height: 100svh;
background: radial-gradient(30rem 20rem at 50% 44%, #2b211a, transparent 74%), var(--color-tb44-bg);
}
.tb-44__plate {
background: radial-gradient(circle at 40% 30%, rgba(255,255,255,.08), transparent 60%), linear-gradient(160deg, #2e241d, var(--color-tb44-plate));
}
/* BAKELITE: mottled two-blotch overlay + specular, which is what separates it
from plain dark plastic. */
.tb-44__knob {
background: radial-gradient(circle at 36% 28%, var(--color-tb44-bake-hi), transparent 58%), radial-gradient(1.4rem 1rem at 70% 74%, rgba(0,0,0,.4), transparent 70%), linear-gradient(155deg, var(--color-tb44-bake), var(--color-tb44-bake-lo));
}
/* Safari ≤15.3 shims for the two annulus masks. */
.tb-44__plate > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 76%, #000 78%);
}
.tb-44__knob > span:first-child {
-webkit-mask-image: radial-gradient(farthest-side, transparent 78%, #000 80%);
}
@media (prefers-color-scheme: light) {
.tb-44:not([data-theme="dark"]) {
--color-tb44-bg: oklch(0.25 0.022 50);
}
}
.tb-44[data-theme="light"] {
--color-tb44-bg: oklch(0.25 0.022 50);
}
@media (forced-colors: active) {
.tb-44__plate,
.tb-44__knob {
background: ButtonFace;
border: 1px solid ButtonText;
box-shadow: none;
}
.tb-44__plate > span:first-child,
.tb-44__knob > span:first-child {
display: none;
}
.tb-44__knob > span:last-child {
background: ButtonText;
}
}
```How this works
The throw angle and the tick offset are the same number. The knob rests at -66deg and turns to +66deg; the tick ring starts at from -66deg. Change one and you must change the other, which is much easier to notice when they sit in the same file as two utilities than as two rules forty lines apart.
class="-rotate-[66deg] group-has-checked:rotate-[66deg] ease-tb44-spring"The legends carry the state in text. A rotating knob announces nothing; OFF/ON plus role="switch" is what makes it a control rather than a sculpture.
Focus goes on the label, not the knob, so the ring surrounds the whole plate — a knob-sized ring inside a plate reads as a rendering error.
Make it yours
- Change the throw and the tick offset together, or the pointer lands between ticks.
- More positions: switch to a radio group with one rotation per option.
--color-tb44-lamp: amber for tube gear, green for lab equipment.- Knurl frequency is the second conic's
3.4deg— coarser grips read as heavier gear. - Keep the rotation under ~180° or users cannot tell which way it turned.
Gotchas — read before shipping
role="switch"on a checkbox is correct and well-supported. Do not addaria-checkedas well — the checkbox already exposes it.- A rotating knob gives no textual state. The legend and the role are what make it accessible.
- Masked conic rings alias at small sizes; below 4rem use fewer, thicker ticks.
- The knob must not be the focus target. Focus the label so the ring surrounds the control.
- Two masked conic rings plus three radial layers is near the paint ceiling for one element.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 113+ | 17.2+ | 128+ | 113+ |
:has() and repeating-conic-gradient sit below Tailwind v4's floor; linear() spring easing needs Chrome 113 / Safari 17.2 / Firefox 112 behind the token's cubic-bezier fallback.