# Thread spool colour picker

> Wooden thread spools on a shelf: the chosen one rises, spins and lets out a strand that curls downwards.

- Category: [Radio buttons](https://library.aimran.es/components/radios)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-rd-thread-spool
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Five wooden spools of sewing thread stand on a small shelf, each one a real radio input. The chosen spool lifts off the shelf, its wound thread scrolls as if it were turning, and a loose strand draws itself below it with an SVG stroke. It suits haberdashery shops, embroidery kits, product colour options and craft blogs.

Each thread colour is set in the style of its label, so swap them for your own range. The main color tints the wooden flanges and the secondary one the shelf; keep names to one short word so they fit under each spool.

## Code

### HTML

```html
<fieldset class="uvq04-spl"><legend>Thread colour</legend><div class="rw"><label style="--c:#c8323a"><input type="radio" name="uvq04-spl" checked><span class="sp" aria-hidden="true"><i class="bd"></i></span><svg class="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39"/></svg><span class="nm">Poppy</span></label><label style="--c:#24365e"><input type="radio" name="uvq04-spl"><span class="sp" aria-hidden="true"><i class="bd"></i></span><svg class="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39"/></svg><span class="nm">Navy</span></label><label style="--c:#d39a2a"><input type="radio" name="uvq04-spl"><span class="sp" aria-hidden="true"><i class="bd"></i></span><svg class="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39"/></svg><span class="nm">Mustard</span></label><label style="--c:#2f6b4a"><input type="radio" name="uvq04-spl"><span class="sp" aria-hidden="true"><i class="bd"></i></span><svg class="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39"/></svg><span class="nm">Bottle green</span></label><label style="--c:#e6dcc6"><input type="radio" name="uvq04-spl"><span class="sp" aria-hidden="true"><i class="bd"></i></span><svg class="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39"/></svg><span class="nm">Ecru</span></label></div></fieldset>
```

### CSS

```css
.uvq04-spl {
  --c1: #c9965c;
  --c2: #7a5230;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq04-spl {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-spl legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-spl .rw {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: 0 .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 15%),color-mix(in srgb,var(--c2),#000 25%)) 0 3.35em/100% .32em no-repeat;
}

.uvq04-spl label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 3.3em;
  cursor: pointer;
}

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

.uvq04-spl .sp {
  position: relative;
  display: block;
  width: 2.3em;
  height: 3.35em;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-spl .sp::before,.uvq04-spl .sp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: .5em;
  border-radius: .25em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1),#000 32%),var(--c1) 35%,color-mix(in srgb,var(--c1),#fff 32%) 50%,var(--c1) 65%,color-mix(in srgb,var(--c1),#000 38%));
  box-shadow: 0 .1em .15em rgba(0,0,0,.28);
}

.uvq04-spl .sp::before {
  top: 0;
}

.uvq04-spl .sp::after {
  bottom: 0;
}

.uvq04-spl .bd {
  position: absolute;
  left: .28em;
  right: .28em;
  top: .42em;
  bottom: .42em;
  background: repeating-linear-gradient(rgba(0,0,0,.17) 0 1px,transparent 1px 3px) 0 0/100% 3px,linear-gradient(90deg,color-mix(in srgb,var(--c),#000 38%),var(--c) 30%,color-mix(in srgb,var(--c),#fff 30%) 48%,var(--c) 66%,color-mix(in srgb,var(--c),#000 42%));
}

.uvq04-spl .th {
  display: block;
  width: 1.4em;
  height: 2.3em;
  margin-top: -.15em;
  overflow: visible;
}

.uvq04-spl .th path {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 .4px rgba(0,0,0,.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl .nm {
  font-size: .66em;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl label:hover .sp {
  transform: translateY(-.12em) rotate(-4deg);
}

.uvq04-spl label:active .sp {
  transform: scale(.93);
}

.uvq04-spl input:checked + .sp {
  transform: translateY(-.35em);
}

.uvq04-spl input:checked + .sp .bd {
  animation: uvq04-spl calc(0.3s / var(--k)) linear infinite;
}

.uvq04-spl input:checked ~ .th path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k));
}

.uvq04-spl input:checked ~ .nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq04-spl input:focus-visible + .sp {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: .3em;
}

@keyframes uvq04-spl {
  to {
    background-position: 0 -3px,0 0;
  }
}

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

### React

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

const css = `
.uvq04-spl {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-spl legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-spl .rw {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: 0 .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 15%),color-mix(in srgb,var(--c2),#000 25%)) 0 3.35em/100% .32em no-repeat;
}

.uvq04-spl label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 3.3em;
  cursor: pointer;
}

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

.uvq04-spl .sp {
  position: relative;
  display: block;
  width: 2.3em;
  height: 3.35em;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-spl .sp::before,.uvq04-spl .sp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: .5em;
  border-radius: .25em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1),#000 32%),var(--c1) 35%,color-mix(in srgb,var(--c1),#fff 32%) 50%,var(--c1) 65%,color-mix(in srgb,var(--c1),#000 38%));
  box-shadow: 0 .1em .15em rgba(0,0,0,.28);
}

.uvq04-spl .sp::before {
  top: 0;
}

.uvq04-spl .sp::after {
  bottom: 0;
}

.uvq04-spl .bd {
  position: absolute;
  left: .28em;
  right: .28em;
  top: .42em;
  bottom: .42em;
  background: repeating-linear-gradient(rgba(0,0,0,.17) 0 1px,transparent 1px 3px) 0 0/100% 3px,linear-gradient(90deg,color-mix(in srgb,var(--c),#000 38%),var(--c) 30%,color-mix(in srgb,var(--c),#fff 30%) 48%,var(--c) 66%,color-mix(in srgb,var(--c),#000 42%));
}

.uvq04-spl .th {
  display: block;
  width: 1.4em;
  height: 2.3em;
  margin-top: -.15em;
  overflow: visible;
}

.uvq04-spl .th path {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 .4px rgba(0,0,0,.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl .nm {
  font-size: .66em;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl label:hover .sp {
  transform: translateY(-.12em) rotate(-4deg);
}

.uvq04-spl label:active .sp {
  transform: scale(.93);
}

.uvq04-spl input:checked + .sp {
  transform: translateY(-.35em);
}

.uvq04-spl input:checked + .sp .bd {
  animation: uvq04-spl calc(0.3s / var(--k)) linear infinite;
}

.uvq04-spl input:checked ~ .th path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k));
}

.uvq04-spl input:checked ~ .nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq04-spl input:focus-visible + .sp {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: .3em;
}

@keyframes uvq04-spl {
  to {
    background-position: 0 -3px,0 0;
  }
}

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

export default function RdThreadSpool() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c9965c",
          "--c2": "#7a5230",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-spl"><legend>Thread colour</legend><div className="rw"><label style={{ "--c": "#c8323a" } as CSSProperties}><input type="radio" name="uvq04-spl" checked={true} /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Poppy</span></label><label style={{ "--c": "#24365e" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Navy</span></label><label style={{ "--c": "#d39a2a" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Mustard</span></label><label style={{ "--c": "#2f6b4a" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Bottle green</span></label><label style={{ "--c": "#e6dcc6" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Ecru</span></label></div></fieldset>
      </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 “Thread spool colour picker” block (Radio buttons) from AIMRAN Library to my project.

## What it is
Wooden thread spools on a shelf: the chosen one rises, spins and lets out a strand that curls downwards.

## Chosen settings
- Main color: #c9965c
- Secondary color: #7a5230
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Color del hilo"

## 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 = `
.uvq04-spl {
  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;
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
  text-align: center;
}

.uvq04-spl legend {
  padding: 0;
  margin: 0 0 .8em;
  font-weight: 700;
  width: 100%;
}

.uvq04-spl .rw {
  display: flex;
  justify-content: center;
  gap: .5em;
  padding: 0 .5em;
  background: linear-gradient(color-mix(in srgb,var(--c2),#fff 15%),color-mix(in srgb,var(--c2),#000 25%)) 0 3.35em/100% .32em no-repeat;
}

.uvq04-spl label {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 3.3em;
  cursor: pointer;
}

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

.uvq04-spl .sp {
  position: relative;
  display: block;
  width: 2.3em;
  height: 3.35em;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq04-spl .sp::before,.uvq04-spl .sp::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: .5em;
  border-radius: .25em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c1),#000 32%),var(--c1) 35%,color-mix(in srgb,var(--c1),#fff 32%) 50%,var(--c1) 65%,color-mix(in srgb,var(--c1),#000 38%));
  box-shadow: 0 .1em .15em rgba(0,0,0,.28);
}

.uvq04-spl .sp::before {
  top: 0;
}

.uvq04-spl .sp::after {
  bottom: 0;
}

.uvq04-spl .bd {
  position: absolute;
  left: .28em;
  right: .28em;
  top: .42em;
  bottom: .42em;
  background: repeating-linear-gradient(rgba(0,0,0,.17) 0 1px,transparent 1px 3px) 0 0/100% 3px,linear-gradient(90deg,color-mix(in srgb,var(--c),#000 38%),var(--c) 30%,color-mix(in srgb,var(--c),#fff 30%) 48%,var(--c) 66%,color-mix(in srgb,var(--c),#000 42%));
}

.uvq04-spl .th {
  display: block;
  width: 1.4em;
  height: 2.3em;
  margin-top: -.15em;
  overflow: visible;
}

.uvq04-spl .th path {
  fill: none;
  stroke: var(--c);
  stroke-width: 1.6;
  stroke-linecap: round;
  filter: drop-shadow(0 0 .4px rgba(0,0,0,.45));
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  transition: stroke-dashoffset calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl .nm {
  font-size: .66em;
  font-weight: 600;
  line-height: 1.15;
  overflow-wrap: anywhere;
  hyphens: auto;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-spl label:hover .sp {
  transform: translateY(-.12em) rotate(-4deg);
}

.uvq04-spl label:active .sp {
  transform: scale(.93);
}

.uvq04-spl input:checked + .sp {
  transform: translateY(-.35em);
}

.uvq04-spl input:checked + .sp .bd {
  animation: uvq04-spl calc(0.3s / var(--k)) linear infinite;
}

.uvq04-spl input:checked ~ .th path {
  stroke-dashoffset: 0;
  transition: stroke-dashoffset calc(0.9s / var(--k)) cubic-bezier(.22,1,.36,1) calc(0.15s / var(--k));
}

.uvq04-spl input:checked ~ .nm {
  color: var(--fg);
  font-weight: 800;
}

.uvq04-spl input:focus-visible + .sp {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
  border-radius: .3em;
}

@keyframes uvq04-spl {
  to {
    background-position: 0 -3px,0 0;
  }
}

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

export default function RdThreadSpool() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c9965c",
          "--c2": "#7a5230",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-spl"><legend>Thread colour</legend><div className="rw"><label style={{ "--c": "#c8323a" } as CSSProperties}><input type="radio" name="uvq04-spl" checked={true} /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Poppy</span></label><label style={{ "--c": "#24365e" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Navy</span></label><label style={{ "--c": "#d39a2a" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Mustard</span></label><label style={{ "--c": "#2f6b4a" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Bottle green</span></label><label style={{ "--c": "#e6dcc6" } as CSSProperties}><input type="radio" name="uvq04-spl" /><span className="sp" aria-hidden="true"><i className="bd"></i></span><svg className="th" viewBox="0 0 24 40" aria-hidden="true"><path pathLength="1" d="M15 0C18 9 5 12 10 21S21 31 9 39" /></svg><span className="nm">Ecru</span></label></div></fieldset>
      </div>
    </>
  );
}
```

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