# Paper pinwheel toggle

> A paper pinwheel pinned to a wooden stick starts spinning while gusts of wind drift past behind it.

- Category: [Toggles](https://library.aimran.es/components/toggles)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-tg-pinwheel
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

This switch is a garden pinwheel made of four folded paper blades in two colors, pinned to a wooden stick. Off, it sits still with a slight tilt; on, it spins steadily while thin gusts of wind slide across behind it, and turning it off freezes it where it is. It fits ventilation settings, weather apps and garden shops.

The two colors paint alternate blades and their folds. Pastel pairs give a seaside feel, strong red and yellow a fairground one. The speed control changes how fast it spins.

## Code

### HTML

```html
<label class="uvq03-pnw"><input type="checkbox" role="switch"><span class="pw"><span class="wd"><i></i><i></i><i></i></span><i class="sk"></i><span class="hb"><span class="rt"><i class="f" style="--i:0"></i><i class="m" style="--i:0"></i><i class="f" style="--i:1"></i><i class="m" style="--i:1"></i><i class="f" style="--i:2"></i><i class="m" style="--i:2"></i><i class="f" style="--i:3"></i><i class="m" style="--i:3"></i></span><i class="pn"></i></span></span>Ventilation</label>
```

### CSS

```css
.uvq03-pnw {
  --c1: #ff5d73;
  --c2: #ffd23f;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq03-pnw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-pnw input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-pnw .pw {
  position: relative;
  display: block;
  flex: none;
  width: 3.6em;
  height: 4.7em;
  border-radius: .5em;
}

.uvq03-pnw .sk {
  position: absolute;
  left: calc(50% - .08em);
  top: 1.6em;
  width: .16em;
  height: 3.05em;
  border-radius: .08em;
  background: linear-gradient(90deg,#a8743d,#e0b47a 50%,#9a6a35);
}

.uvq03-pnw .hb {
  position: absolute;
  left: .3em;
  top: .2em;
  width: 3em;
  height: 3em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-pnw .rt {
  position: absolute;
  inset: 0;
  animation: uvq03-pnw calc(0.7s / var(--k)) linear infinite paused;
}

.uvq03-pnw .rt i {
  position: absolute;
  inset: 0;
  transform: rotate(calc(var(--i) * 90deg));
}

.uvq03-pnw .m {
  clip-path: polygon(50% 50%,0 0,47% 0);
  background: linear-gradient(135deg,color-mix(in srgb,var(--c1) 70%,#000),var(--c1) 60%);
}

.uvq03-pnw .f {
  clip-path: polygon(50% 50%,0 0,0 20%);
  background: linear-gradient(200deg,color-mix(in srgb,var(--c2) 55%,#fff),var(--c2));
}

.uvq03-pnw .rt i:nth-child(4n+4) {
  background: linear-gradient(135deg,color-mix(in srgb,var(--c2) 75%,#000),var(--c2) 60%);
}

.uvq03-pnw .rt i:nth-child(4n+3) {
  background: linear-gradient(200deg,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
}

.uvq03-pnw .pn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .36em;
  height: .36em;
  margin: -.18em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,#fff,#9aa0a8);
  box-shadow: 0 .05em .1em rgba(0,0,0,.4);
}

.uvq03-pnw .wd {
  position: absolute;
  inset: .4em -.4em 1.4em;
  overflow: hidden;
}

.uvq03-pnw .wd i {
  position: absolute;
  left: 0;
  width: 1.3em;
  height: .08em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 35%,transparent);
  opacity: 0;
}

.uvq03-pnw .wd i:nth-child(1) {
  top: .5em;
}

.uvq03-pnw .wd i:nth-child(2) {
  top: 1.5em;
  width: .9em;
}

.uvq03-pnw .wd i:nth-child(3) {
  top: 2.4em;
}

.uvq03-pnw:hover input:not(:checked) + .pw .hb {
  transform: rotate(25deg);
}

.uvq03-pnw:active .hb {
  scale: .95;
}

.uvq03-pnw input:checked + .pw .rt {
  animation-play-state: running;
}

.uvq03-pnw input:checked + .pw .wd i {
  animation: uvq03-pnw-w calc(1.1s / var(--k)) linear infinite;
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(2) {
  animation-delay: calc(0.4s / var(--k));
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(3) {
  animation-delay: calc(0.75s / var(--k));
}

@keyframes uvq03-pnw {
  to {
    transform: rotate(-1turn);
  }
}

@keyframes uvq03-pnw-w {
  0% {
    opacity: 0;
    transform: translateX(-1.4em);
  }
  30%,70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(4em);
  }
}

.uvq03-pnw input:focus-visible + .pw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-pnw,.uvq03-pnw *,.uvq03-pnw *::before,.uvq03-pnw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
```

### React

```tsx
import type { CSSProperties } from "react";

const css = `
.uvq03-pnw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-pnw input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-pnw .pw {
  position: relative;
  display: block;
  flex: none;
  width: 3.6em;
  height: 4.7em;
  border-radius: .5em;
}

.uvq03-pnw .sk {
  position: absolute;
  left: calc(50% - .08em);
  top: 1.6em;
  width: .16em;
  height: 3.05em;
  border-radius: .08em;
  background: linear-gradient(90deg,#a8743d,#e0b47a 50%,#9a6a35);
}

.uvq03-pnw .hb {
  position: absolute;
  left: .3em;
  top: .2em;
  width: 3em;
  height: 3em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-pnw .rt {
  position: absolute;
  inset: 0;
  animation: uvq03-pnw calc(0.7s / var(--k)) linear infinite paused;
}

.uvq03-pnw .rt i {
  position: absolute;
  inset: 0;
  transform: rotate(calc(var(--i) * 90deg));
}

.uvq03-pnw .m {
  clip-path: polygon(50% 50%,0 0,47% 0);
  background: linear-gradient(135deg,color-mix(in srgb,var(--c1) 70%,#000),var(--c1) 60%);
}

.uvq03-pnw .f {
  clip-path: polygon(50% 50%,0 0,0 20%);
  background: linear-gradient(200deg,color-mix(in srgb,var(--c2) 55%,#fff),var(--c2));
}

.uvq03-pnw .rt i:nth-child(4n+4) {
  background: linear-gradient(135deg,color-mix(in srgb,var(--c2) 75%,#000),var(--c2) 60%);
}

.uvq03-pnw .rt i:nth-child(4n+3) {
  background: linear-gradient(200deg,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
}

.uvq03-pnw .pn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .36em;
  height: .36em;
  margin: -.18em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,#fff,#9aa0a8);
  box-shadow: 0 .05em .1em rgba(0,0,0,.4);
}

.uvq03-pnw .wd {
  position: absolute;
  inset: .4em -.4em 1.4em;
  overflow: hidden;
}

.uvq03-pnw .wd i {
  position: absolute;
  left: 0;
  width: 1.3em;
  height: .08em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 35%,transparent);
  opacity: 0;
}

.uvq03-pnw .wd i:nth-child(1) {
  top: .5em;
}

.uvq03-pnw .wd i:nth-child(2) {
  top: 1.5em;
  width: .9em;
}

.uvq03-pnw .wd i:nth-child(3) {
  top: 2.4em;
}

.uvq03-pnw:hover input:not(:checked) + .pw .hb {
  transform: rotate(25deg);
}

.uvq03-pnw:active .hb {
  scale: .95;
}

.uvq03-pnw input:checked + .pw .rt {
  animation-play-state: running;
}

.uvq03-pnw input:checked + .pw .wd i {
  animation: uvq03-pnw-w calc(1.1s / var(--k)) linear infinite;
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(2) {
  animation-delay: calc(0.4s / var(--k));
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(3) {
  animation-delay: calc(0.75s / var(--k));
}

@keyframes uvq03-pnw {
  to {
    transform: rotate(-1turn);
  }
}

@keyframes uvq03-pnw-w {
  0% {
    opacity: 0;
    transform: translateX(-1.4em);
  }
  30%,70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(4em);
  }
}

.uvq03-pnw input:focus-visible + .pw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-pnw,.uvq03-pnw *,.uvq03-pnw *::before,.uvq03-pnw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function TgPinwheel() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff5d73",
          "--c2": "#ffd23f",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-pnw"><input type="checkbox" role="switch" /><span className="pw"><span className="wd"><i></i><i></i><i></i></span><i className="sk"></i><span className="hb"><span className="rt"><i className="f" style={{ "--i": "0" } as CSSProperties}></i><i className="m" style={{ "--i": "0" } as CSSProperties}></i><i className="f" style={{ "--i": "1" } as CSSProperties}></i><i className="m" style={{ "--i": "1" } as CSSProperties}></i><i className="f" style={{ "--i": "2" } as CSSProperties}></i><i className="m" style={{ "--i": "2" } as CSSProperties}></i><i className="f" style={{ "--i": "3" } as CSSProperties}></i><i className="m" style={{ "--i": "3" } as CSSProperties}></i></span><i className="pn"></i></span></span>Ventilation</label>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Paper pinwheel toggle” block (Toggles) from AIMRAN Library to my project.

## What it is
A paper pinwheel pinned to a wooden stick starts spinning while gusts of wind drift past behind it.

## Chosen settings
- Main color: #ff5d73
- Secondary color: #ffd23f
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Ventilación"

## What I need
1. Add it to my project with the same look and animation as the reference code: same sizes, colours, radii, shadows, timings and easing.
2. It is built with plain HTML and CSS (the reference wraps it in a React component with its CSS). If my project uses something else (Vue, Svelte, Astro, plain HTML…), translate it without losing any behaviour. If I use Tailwind, turn the styles into classes; if not, keep the CSS in its own file.
3. Expose the settings above as props (or CSS variables) with those values as defaults.
4. Make it work well on phones: nothing that depends only on hover, touch targets of at least 44 px and no overflow on 320 px screens.
5. Make it look right in light and dark mode.
6. Keep it accessible: semantic HTML, roles and aria-* where needed, visible focus and keyboard support.
7. Respect prefers-reduced-motion: with reduced motion, no big animations but the same end result.

## Reference code
```tsx
import type { CSSProperties } from "react";

const css = `
.uvq03-pnw {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  color: var(--fg);
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .8em;
  cursor: pointer;
  user-select: none;
  font-weight: 550;
}

.uvq03-pnw input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-pnw .pw {
  position: relative;
  display: block;
  flex: none;
  width: 3.6em;
  height: 4.7em;
  border-radius: .5em;
}

.uvq03-pnw .sk {
  position: absolute;
  left: calc(50% - .08em);
  top: 1.6em;
  width: .16em;
  height: 3.05em;
  border-radius: .08em;
  background: linear-gradient(90deg,#a8743d,#e0b47a 50%,#9a6a35);
}

.uvq03-pnw .hb {
  position: absolute;
  left: .3em;
  top: .2em;
  width: 3em;
  height: 3em;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-pnw .rt {
  position: absolute;
  inset: 0;
  animation: uvq03-pnw calc(0.7s / var(--k)) linear infinite paused;
}

.uvq03-pnw .rt i {
  position: absolute;
  inset: 0;
  transform: rotate(calc(var(--i) * 90deg));
}

.uvq03-pnw .m {
  clip-path: polygon(50% 50%,0 0,47% 0);
  background: linear-gradient(135deg,color-mix(in srgb,var(--c1) 70%,#000),var(--c1) 60%);
}

.uvq03-pnw .f {
  clip-path: polygon(50% 50%,0 0,0 20%);
  background: linear-gradient(200deg,color-mix(in srgb,var(--c2) 55%,#fff),var(--c2));
}

.uvq03-pnw .rt i:nth-child(4n+4) {
  background: linear-gradient(135deg,color-mix(in srgb,var(--c2) 75%,#000),var(--c2) 60%);
}

.uvq03-pnw .rt i:nth-child(4n+3) {
  background: linear-gradient(200deg,color-mix(in srgb,var(--c1) 55%,#fff),var(--c1));
}

.uvq03-pnw .pn {
  position: absolute;
  left: 50%;
  top: 50%;
  width: .36em;
  height: .36em;
  margin: -.18em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%,#fff,#9aa0a8);
  box-shadow: 0 .05em .1em rgba(0,0,0,.4);
}

.uvq03-pnw .wd {
  position: absolute;
  inset: .4em -.4em 1.4em;
  overflow: hidden;
}

.uvq03-pnw .wd i {
  position: absolute;
  left: 0;
  width: 1.3em;
  height: .08em;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 35%,transparent);
  opacity: 0;
}

.uvq03-pnw .wd i:nth-child(1) {
  top: .5em;
}

.uvq03-pnw .wd i:nth-child(2) {
  top: 1.5em;
  width: .9em;
}

.uvq03-pnw .wd i:nth-child(3) {
  top: 2.4em;
}

.uvq03-pnw:hover input:not(:checked) + .pw .hb {
  transform: rotate(25deg);
}

.uvq03-pnw:active .hb {
  scale: .95;
}

.uvq03-pnw input:checked + .pw .rt {
  animation-play-state: running;
}

.uvq03-pnw input:checked + .pw .wd i {
  animation: uvq03-pnw-w calc(1.1s / var(--k)) linear infinite;
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(2) {
  animation-delay: calc(0.4s / var(--k));
}

.uvq03-pnw input:checked + .pw .wd i:nth-child(3) {
  animation-delay: calc(0.75s / var(--k));
}

@keyframes uvq03-pnw {
  to {
    transform: rotate(-1turn);
  }
}

@keyframes uvq03-pnw-w {
  0% {
    opacity: 0;
    transform: translateX(-1.4em);
  }
  30%,70% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateX(4em);
  }
}

.uvq03-pnw input:focus-visible + .pw {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@media (prefers-reduced-motion:reduce) {
  .uvq03-pnw,.uvq03-pnw *,.uvq03-pnw *::before,.uvq03-pnw *::after {
    animation-duration: .01ms!important;
    animation-iteration-count: 1!important;
    transition-duration: .01ms!important;
  }
}
`;

export default function TgPinwheel() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff5d73",
          "--c2": "#ffd23f",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-pnw"><input type="checkbox" role="switch" /><span className="pw"><span className="wd"><i></i><i></i><i></i></span><i className="sk"></i><span className="hb"><span className="rt"><i className="f" style={{ "--i": "0" } as CSSProperties}></i><i className="m" style={{ "--i": "0" } as CSSProperties}></i><i className="f" style={{ "--i": "1" } as CSSProperties}></i><i className="m" style={{ "--i": "1" } as CSSProperties}></i><i className="f" style={{ "--i": "2" } as CSSProperties}></i><i className="m" style={{ "--i": "2" } as CSSProperties}></i><i className="f" style={{ "--i": "3" } as CSSProperties}></i><i className="m" style={{ "--i": "3" } as CSSProperties}></i></span><i className="pn"></i></span></span>Ventilation</label>
      </div>
    </>
  );
}
```

Give me the complete final code, ready to paste, and tell me in one line where to put it in my project.
````
