Solar
const css = `
@keyframes toggle-solar-shine { to { background-position: -40px 0, 0 0; } }
.toggle-solar { position: relative; display: inline-flex; align-items: center; gap: 12px; color: light-dark(#42454c, #e5e6e9); font-size: 14px; cursor: pointer; user-select: none; }
.toggle-solar__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.toggle-solar__track { position: relative; width: 94px; height: 32px; border-radius: 6px; perspective: 160px; }
.toggle-solar__input:focus-visible + .toggle-solar__track { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 3px; }
.toggle-solar__strut { position: absolute; left: 2px; right: 2px; top: 15px; height: 2px; background: light-dark(#dbdde1, #2e3035); transform: scaleX(0.12); transition: transform 0.3s ease 0.35s; }
.toggle-solar__body {
position: absolute;
left: 40px;
top: 4px;
width: 14px;
height: 24px;
border-radius: 3px;
background: linear-gradient(90deg, light-dark(#6d7179, #7d8087), light-dark(#50535b, #c6c8cd) 50%, light-dark(#6d7179, #7d8087));
z-index: 1;
}
.toggle-solar__body::before { content: ''; position: absolute; left: 6px; top: -4px; width: 2px; height: 4px; background: light-dark(#6d7179, #7d8087); }
.toggle-solar__light { position: absolute; left: 4px; bottom: 4px; width: 6px; height: 3px; border-radius: 1px; background: light-dark(#dbdde1, #2e3035); transition: background-color 0.2s; }
.toggle-solar__panel {
position: absolute;
top: 6px;
width: 12px;
height: 20px;
border-radius: 1px;
background:
linear-gradient(100deg, transparent 30%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 35%, transparent) 45%, transparent 60%) 40px 0 / 40px 100% no-repeat,
linear-gradient(light-dark(#ebedf0, #232529) 1px, transparent 1px) 0 0 / 100% 5px,
light-dark(#cbced3, #393c41);
box-shadow: inset 0 0 0 1px light-dark(#6d7179, #7d8087);
transform: rotateY(var(--fold));
opacity: 0;
transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) calc((2 - var(--i)) * 0.08s), opacity 0.1s linear calc(0.25s + (2 - var(--i)) * 0.08s);
}
.toggle-solar__panel--l { transform-origin: 100% 50%; --fold: -92deg; }
.toggle-solar__panel--r { transform-origin: 0 50%; --fold: 92deg; }
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__panel {
transform: rotateY(0deg);
opacity: 1;
transition-delay: calc(var(--i) * 0.12s);
animation: toggle-solar-shine 1.8s ease-in-out calc(0.5s + var(--i) * 0.1s) infinite;
}
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__strut { transform: none; transition-delay: 0s; }
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__light { background: light-dark(#373a40, #f1f2f3); transition-delay: 0.5s; }
@media (prefers-reduced-motion: reduce) {
.toggle-solar__track * { transition-duration: 0.01s !important; transition-delay: 0s !important; animation: none !important; }
}
`;
// Three panels a side, each hinged toward the body so they swing out in sequence.
const PANELS = [
{ side: 'r', left: 55, i: 0 },
{ side: 'r', left: 68, i: 1 },
{ side: 'r', left: 81, i: 2 },
{ side: 'l', left: 27, i: 0 },
{ side: 'l', left: 14, i: 1 },
{ side: 'l', left: 1, i: 2 },
];
export function SolarToggle() {
return (
<>
<style>
{css}
</style>
<label className="toggle-solar">
<input className="toggle-solar__input" type="checkbox" role="switch" />
<span className="toggle-solar__track" aria-hidden="true">
<span className="toggle-solar__strut" />
{PANELS.map((p) => (
<span
key={`${p.side}${p.i}`}
className={`toggle-solar__panel toggle-solar__panel--${p.side}`}
style={{ left: p.left, '--i': p.i } as React.CSSProperties}
/>
))}
<span className="toggle-solar__body">
<span className="toggle-solar__light" />
</span>
</span>
Solar charging
</label>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
<label class="toggle-solar"><input class="toggle-solar__input" type="checkbox" role="switch"/><span class="toggle-solar__track" aria-hidden="true"><span class="toggle-solar__strut"></span><span class="toggle-solar__panel toggle-solar__panel--r" style="left:55px;--i:0"></span><span class="toggle-solar__panel toggle-solar__panel--r" style="left:68px;--i:1"></span><span class="toggle-solar__panel toggle-solar__panel--r" style="left:81px;--i:2"></span><span class="toggle-solar__panel toggle-solar__panel--l" style="left:27px;--i:0"></span><span class="toggle-solar__panel toggle-solar__panel--l" style="left:14px;--i:1"></span><span class="toggle-solar__panel toggle-solar__panel--l" style="left:1px;--i:2"></span><span class="toggle-solar__body"><span class="toggle-solar__light"></span></span></span>Solar charging</label>@keyframes toggle-solar-shine { to { background-position: -40px 0, 0 0; } }
.toggle-solar { position: relative; display: inline-flex; align-items: center; gap: 12px; color: light-dark(#42454c, #e5e6e9); font-size: 14px; cursor: pointer; user-select: none; }
.toggle-solar__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; }
.toggle-solar__track { position: relative; width: 94px; height: 32px; border-radius: 6px; perspective: 160px; }
.toggle-solar__input:focus-visible + .toggle-solar__track { outline: 2px solid light-dark(#5f626a, #a7abb2); outline-offset: 3px; }
.toggle-solar__strut { position: absolute; left: 2px; right: 2px; top: 15px; height: 2px; background: light-dark(#dbdde1, #2e3035); transform: scaleX(0.12); transition: transform 0.3s ease 0.35s; }
.toggle-solar__body {
position: absolute;
left: 40px;
top: 4px;
width: 14px;
height: 24px;
border-radius: 3px;
background: linear-gradient(90deg, light-dark(#6d7179, #7d8087), light-dark(#50535b, #c6c8cd) 50%, light-dark(#6d7179, #7d8087));
z-index: 1;
}
.toggle-solar__body::before { content: ''; position: absolute; left: 6px; top: -4px; width: 2px; height: 4px; background: light-dark(#6d7179, #7d8087); }
.toggle-solar__light { position: absolute; left: 4px; bottom: 4px; width: 6px; height: 3px; border-radius: 1px; background: light-dark(#dbdde1, #2e3035); transition: background-color 0.2s; }
.toggle-solar__panel {
position: absolute;
top: 6px;
width: 12px;
height: 20px;
border-radius: 1px;
background:
linear-gradient(100deg, transparent 30%, color-mix(in oklab, light-dark(#373a40, #f1f2f3) 35%, transparent) 45%, transparent 60%) 40px 0 / 40px 100% no-repeat,
linear-gradient(light-dark(#ebedf0, #232529) 1px, transparent 1px) 0 0 / 100% 5px,
light-dark(#cbced3, #393c41);
box-shadow: inset 0 0 0 1px light-dark(#6d7179, #7d8087);
transform: rotateY(var(--fold));
opacity: 0;
transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1) calc((2 - var(--i)) * 0.08s), opacity 0.1s linear calc(0.25s + (2 - var(--i)) * 0.08s);
}
.toggle-solar__panel--l { transform-origin: 100% 50%; --fold: -92deg; }
.toggle-solar__panel--r { transform-origin: 0 50%; --fold: 92deg; }
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__panel {
transform: rotateY(0deg);
opacity: 1;
transition-delay: calc(var(--i) * 0.12s);
animation: toggle-solar-shine 1.8s ease-in-out calc(0.5s + var(--i) * 0.1s) infinite;
}
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__strut { transform: none; transition-delay: 0s; }
.toggle-solar__input:checked + .toggle-solar__track .toggle-solar__light { background: light-dark(#373a40, #f1f2f3); transition-delay: 0.5s; }
@media (prefers-reduced-motion: reduce) {
.toggle-solar__track * { transition-duration: 0.01s !important; transition-delay: 0s !important; animation: none !important; }
}Goal: Create a "Solar" toggle.
Visual behavior: A solar-charging switch: a small satellite unfolds its panels one by one on both sides, then light glints across the cells and its status light turns on.
Technique:
- A real native checkbox with role="switch" (visually hidden: absolute, 1x1, opacity 0) inside a <label>; every visual is aria-hidden and styled from the input with :checked + sibling selectors.
- Six panels sit at their final positions, each hinged toward the body and folded edge-on with rotateY(±92deg) and hidden.
- On, each swings to rotateY(0) inside a perspective, with a delay that grows outward; closing runs the other way.
- Once open, a bright diagonal band slides across the cells on a loop.
Accessibility: A native checkbox with role="switch" inside a <label>, so Space toggles it and screen readers announce a switch; the visible label names it and :focus-visible on the input outlines the visual. Under prefers-reduced-motion the panels appear without folding.
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 "Solar" toggle.
Visual behavior: A solar-charging switch: a small satellite unfolds its panels one by one on both sides, then light glints across the cells and its status light turns on.
Technique:
- A real native checkbox with role="switch" (visually hidden: absolute, 1x1, opacity 0) inside a <label>; every visual is aria-hidden and styled from the input with :checked + sibling selectors.
- Six panels sit at their final positions, each hinged toward the body and folded edge-on with rotateY(±92deg) and hidden.
- On, each swings to rotateY(0) inside a perspective, with a delay that grows outward; closing runs the other way.
- Once open, a bright diagonal band slides across the cells on a loop.
Accessibility: A native checkbox with role="switch" inside a <label>, so Space toggles it and screen readers announce a switch; the visible label names it and :focus-visible on the input outlines the visual. Under prefers-reduced-motion the panels appear without folding.
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 solar-charging switch: a small satellite unfolds its panels one by one on both sides, then light glints across the cells and its status light turns on.
- Dependencies
- None
- Difficulty
- Intermediate
- Triggers
- click, state change, 3d, delay stagger
- Techniques
- 3d transform, perspective, transition delay stagger, gradient
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
A native checkbox with role="switch" inside a <label>, so Space toggles it and screen readers announce a switch; the visible label names it and :focus-visible on the input outlines the visual. Under prefers-reduced-motion the panels appear without folding.