Burner
import { useId } from 'react';
const css = `
@keyframes radio-burner-flicker {
0%, 100% { transform: scaleY(1) skewX(0deg); }
30% { transform: scaleY(0.86) skewX(4deg); }
60% { transform: scaleY(1.06) skewX(-3deg); }
}
.radio-burner { --radio-burner-h: 0.35; --radio-burner-k: -70deg; display: grid; justify-items: center; gap: 14px; }
.radio-burner:has(.radio-burner__input[value='medium']:checked) { --radio-burner-h: 0.65; --radio-burner-k: 0deg; }
.radio-burner:has(.radio-burner__input[value='high']:checked) { --radio-burner-h: 1; --radio-burner-k: 70deg; }
.radio-burner__stove { display: flex; align-items: flex-end; gap: 22px; }
.radio-burner__ring { position: relative; width: 130px; height: 62px; }
.radio-burner__glow {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 50px;
background: radial-gradient(50% 70% at 50% 100%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 22%, transparent), transparent);
opacity: calc(0.3 + var(--radio-burner-h) * 0.7);
transition: opacity 0.5s;
}
.radio-burner__base { position: absolute; left: 4px; right: 4px; bottom: 0; height: 10px; border-radius: 5px; background: linear-gradient(light-dark(#5f626a, #a7abb2), light-dark(#cbced3, #393c41)); }
.radio-burner__flames { position: absolute; left: 10px; right: 10px; bottom: 9px; display: flex; justify-content: space-between; align-items: flex-end; }
.radio-burner__flame {
width: 10px;
height: 46px;
transform-origin: 50% 100%;
transform: scaleY(var(--radio-burner-h));
transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) calc(var(--i) * 25ms);
}
.radio-burner__flame::before {
content: '';
display: block;
width: 10px;
height: 46px;
border-radius: 50% 50% 45% 45% / 75% 75% 25% 25%;
background: linear-gradient(to top, light-dark(#5f626a, #a7abb2), light-dark(#373a40, #f1f2f3) 35%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 10%, transparent));
transform-origin: 50% 100%;
animation: radio-burner-flicker 0.5s ease-in-out infinite;
animation-delay: calc(var(--i) * -0.13s);
}
.radio-burner__knob {
position: relative;
width: 36px;
height: 36px;
border-radius: 50%;
background: radial-gradient(circle at 38% 32%, light-dark(#50535b, #c6c8cd), light-dark(#cbced3, #393c41));
box-shadow: 0 3px 6px color-mix(in oklab, light-dark(#fbfcfd, #121417) 60%, transparent);
transform: rotate(var(--radio-burner-k));
transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.radio-burner__knob::after { content: ''; position: absolute; left: 16.5px; top: 4px; width: 3px; height: 12px; border-radius: 2px; background: light-dark(#f3f4f7, #1a1c1f); }
.radio-burner__opts { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-burner__opt {
position: relative;
padding: 5px 12px;
border-radius: 7px;
color: light-dark(#5f626a, #a7abb2);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: color 0.2s, background-color 0.2s;
}
.radio-burner__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-burner__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.radio-burner__opt:has(.radio-burner__input:focus-visible) { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 2px; }
.radio-burner__opt:has(.radio-burner__input:checked) { background: light-dark(#42454c, #e5e6e9); color: light-dark(#fbfcfd, #121417); }
@media (prefers-reduced-motion: reduce) {
.radio-burner *, .radio-burner *::before { animation: none !important; transition-duration: 0.01s !important; transition-delay: 0s !important; }
}
`;
const HEATS = [
{ value: 'low', label: 'Low' },
{ value: 'medium', label: 'Medium' },
{ value: 'high', label: 'High' },
];
export function BurnerRadio() {
const name = useId();
return (
<>
<style>
{css}
</style>
<div className="radio-burner">
<span className="radio-burner__stove" aria-hidden="true">
<span className="radio-burner__ring">
<span className="radio-burner__glow" />
<span className="radio-burner__flames">
{Array.from({ length: 9 }, (_, i) => (
<span key={i} className="radio-burner__flame" style={{ '--i': i } as React.CSSProperties} />
))}
</span>
<span className="radio-burner__base" />
</span>
<span className="radio-burner__knob" />
</span>
<div className="radio-burner__opts" role="radiogroup" aria-label="Flame">
{HEATS.map((h, i) => (
<label key={h.value} className="radio-burner__opt">
<input className="radio-burner__input" type="radio" name={name} value={h.value} defaultChecked={i === 0} />
{h.label}
</label>
))}
</div>
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
<div class="radio-burner">
<span class="radio-burner__stove" aria-hidden="true">
<span class="radio-burner__ring">
<span class="radio-burner__glow"></span>
<span class="radio-burner__flames">
<span class="radio-burner__flame" style="--i:0"></span>
<span class="radio-burner__flame" style="--i:1"></span>
<span class="radio-burner__flame" style="--i:2"></span>
<span class="radio-burner__flame" style="--i:3"></span>
<span class="radio-burner__flame" style="--i:4"></span>
<span class="radio-burner__flame" style="--i:5"></span>
<span class="radio-burner__flame" style="--i:6"></span>
<span class="radio-burner__flame" style="--i:7"></span>
<span class="radio-burner__flame" style="--i:8"></span>
</span>
<span class="radio-burner__base"></span>
</span>
<span class="radio-burner__knob"></span>
</span>
<div class="radio-burner__opts" role="radiogroup" aria-label="Flame">
<label class="radio-burner__opt"><input class="radio-burner__input" type="radio" name="radio-burner" checked="" value="low"/>Low</label>
<label class="radio-burner__opt"><input class="radio-burner__input" type="radio" name="radio-burner" value="medium"/>Medium</label>
<label class="radio-burner__opt"><input class="radio-burner__input" type="radio" name="radio-burner" value="high"/>High</label>
</div>
</div>@keyframes radio-burner-flicker {
0%, 100% { transform: scaleY(1) skewX(0deg); }
30% { transform: scaleY(0.86) skewX(4deg); }
60% { transform: scaleY(1.06) skewX(-3deg); }
}
.radio-burner { --radio-burner-h: 0.35; --radio-burner-k: -70deg; display: grid; justify-items: center; gap: 14px; }
.radio-burner:has(.radio-burner__input[value='medium']:checked) { --radio-burner-h: 0.65; --radio-burner-k: 0deg; }
.radio-burner:has(.radio-burner__input[value='high']:checked) { --radio-burner-h: 1; --radio-burner-k: 70deg; }
.radio-burner__stove { display: flex; align-items: flex-end; gap: 22px; }
.radio-burner__ring { position: relative; width: 130px; height: 62px; }
.radio-burner__glow {
position: absolute;
left: 0;
right: 0;
bottom: 0;
height: 50px;
background: radial-gradient(50% 70% at 50% 100%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 22%, transparent), transparent);
opacity: calc(0.3 + var(--radio-burner-h) * 0.7);
transition: opacity 0.5s;
}
.radio-burner__base { position: absolute; left: 4px; right: 4px; bottom: 0; height: 10px; border-radius: 5px; background: linear-gradient(light-dark(#5f626a, #a7abb2), light-dark(#cbced3, #393c41)); }
.radio-burner__flames { position: absolute; left: 10px; right: 10px; bottom: 9px; display: flex; justify-content: space-between; align-items: flex-end; }
.radio-burner__flame {
width: 10px;
height: 46px;
transform-origin: 50% 100%;
transform: scaleY(var(--radio-burner-h));
transition: transform 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) calc(var(--i) * 25ms);
}
.radio-burner__flame::before {
content: '';
display: block;
width: 10px;
height: 46px;
border-radius: 50% 50% 45% 45% / 75% 75% 25% 25%;
background: linear-gradient(to top, light-dark(#5f626a, #a7abb2), light-dark(#373a40, #f1f2f3) 35%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 10%, transparent));
transform-origin: 50% 100%;
animation: radio-burner-flicker 0.5s ease-in-out infinite;
animation-delay: calc(var(--i) * -0.13s);
}
.radio-burner__knob {
position: relative;
width: 36px;
height: 36px;
border-radius: 50%;
background: radial-gradient(circle at 38% 32%, light-dark(#50535b, #c6c8cd), light-dark(#cbced3, #393c41));
box-shadow: 0 3px 6px color-mix(in oklab, light-dark(#fbfcfd, #121417) 60%, transparent);
transform: rotate(var(--radio-burner-k));
transition: transform 0.45s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.radio-burner__knob::after { content: ''; position: absolute; left: 16.5px; top: 4px; width: 3px; height: 12px; border-radius: 2px; background: light-dark(#f3f4f7, #1a1c1f); }
.radio-burner__opts { display: flex; gap: 4px; padding: 4px; border-radius: 10px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-burner__opt {
position: relative;
padding: 5px 12px;
border-radius: 7px;
color: light-dark(#5f626a, #a7abb2);
font-size: 12px;
font-weight: 600;
cursor: pointer;
transition: color 0.2s, background-color 0.2s;
}
.radio-burner__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-burner__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.radio-burner__opt:has(.radio-burner__input:focus-visible) { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 2px; }
.radio-burner__opt:has(.radio-burner__input:checked) { background: light-dark(#42454c, #e5e6e9); color: light-dark(#fbfcfd, #121417); }
@media (prefers-reduced-motion: reduce) {
.radio-burner *, .radio-burner *::before { animation: none !important; transition-duration: 0.01s !important; transition-delay: 0s !important; }
}Goal: Create a "Burner" radio.
Visual behavior: A gas burner: choose low, medium or high and the knob turns while the row of flickering flames drops low or roars up, the glow under them following.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Each flame is scaled by the heat variable on its outer element, while its ::before flickers on a loop with its own negative delay, so the two never fight.
- The knob angle comes from the same choice. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flames hold still at the chosen height.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: neutral only. Black, white and grays, no hues. Use the color values above as written, or my project's closest neutral tokens.
Return a single self-contained component. No dependencies.Goal: Create a "Burner" radio.
Visual behavior: A gas burner: choose low, medium or high and the knob turns while the row of flickering flames drops low or roars up, the glow under them following.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Each flame is scaled by the heat variable on its outer element, while its ::before flickers on a loop with its own negative delay, so the two never fight.
- The knob angle comes from the same choice. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flames hold still at the chosen height.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: use my project's existing color tokens. The color values above are grayscale placeholders. Map each one by its role (surface, text, border, accent, glow) to my theme, and keep their relative lightness so contrast and the effect still read.
Return a single self-contained component. No dependencies.Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Free to use in any project, commercial included. MIT-0, no attribution required. Licence
About this component
A gas burner: choose low, medium or high and the knob turns while the row of flickering flames drops low or roars up, the glow under them following.
- Dependencies
- None
- Difficulty
- Intermediate
- Triggers
- click, state change, continuous, glow
- Techniques
- css variables, keyframes, pseudo elements
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the flames hold still at the chosen height.