# Paint swatch fan deck

> A paint swatch deck opened like a fan: the chosen strip slides out and tints the wall behind it.

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

## Where to use it

Six paint strips are riveted at the bottom and spread like a real colour fan deck. Each strip shows three tints and a name with its code. The chosen strip slides out along its own angle and rises above the others, and the card behind it takes a soft wash of that paint, like a wall sample.

The paint colours live in each strip's style, so swap them for your brand palette, fabric finishes or wood stains. Five to seven strips keep the fan readable, and the arrow keys walk through them in order.

## Code

### HTML

```html
<fieldset class="uvq04-fan"><legend>Wall colour</legend><div class="fn"><label style="--a:-50deg;--c:#c4673f"><input type="radio" name="uvq04-fan"><span class="sw"><span class="nm"><b>Clay</b> R-214</span></span></label><label style="--a:-30deg;--c:#d9a53a"><input type="radio" name="uvq04-fan"><span class="sw"><span class="nm"><b>Mustard</b> Y-108</span></span></label><label style="--a:-10deg;--c:#8fa98a"><input type="radio" name="uvq04-fan" checked><span class="sw"><span class="nm"><b>Sage</b> G-322</span></span></label><label style="--a:10deg;--c:#2f6f8f"><input type="radio" name="uvq04-fan"><span class="sw"><span class="nm"><b>Ocean</b> B-517</span></span></label><label style="--a:30deg;--c:#6e3a5e"><input type="radio" name="uvq04-fan"><span class="sw"><span class="nm"><b>Plum</b> V-640</span></span></label><label style="--a:50deg;--c:#aab4c0"><input type="radio" name="uvq04-fan"><span class="sw"><span class="nm"><b>Fog</b> N-090</span></span></label><i class="rv" aria-hidden="true"></i></div></fieldset>
```

### CSS

```css
.uvq04-fan {
  --c1: #2b2b2b;
  --c2: #d9d4ca;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq04-fan {
  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;
  width: 19em;
  padding: 1em .5em .4em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--pk,#8fa98a) 22%,var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: .2em;
  text-align: center;
  font-weight: 700;
}

.uvq04-fan .fn {
  clear: both;
  position: relative;
  height: 11.6em;
}

.uvq04-fan label {
  position: absolute;
  left: 50%;
  bottom: .6em;
  width: 2.3em;
  height: 9.8em;
  margin-left: -1.15em;
  transform-origin: 50% calc(100% - 1.1em);
  transform: rotate(var(--a)) translateY(var(--y,0));
  cursor: pointer;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq04-fan .sw {
  position: absolute;
  inset: 0;
  border-radius: .35em;
  background: linear-gradient(color-mix(in srgb,var(--c),#fff 50%) 0 22%,color-mix(in srgb,var(--c),#fff 25%) 0 44%,var(--c) 0 70%,#fbfaf6 0);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08),.1em .25em .5em rgba(0,0,0,.18);
  transition: box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan .nm {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.9em;
  display: flex;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .5em;
  letter-spacing: .04em;
  white-space: nowrap;
  color: #4b4b4b;
}

.uvq04-fan .nm b {
  margin-bottom: .4em;
}

.uvq04-fan .rv {
  position: absolute;
  left: 50%;
  bottom: 1.2em;
  width: .9em;
  height: .9em;
  margin: 0 0 -.45em -.45em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,#f2f2f2,#8d8d8d 60%,#5b5b5b);
  box-shadow: 0 .1em .2em rgba(0,0,0,.4);
  z-index: 20;
}

.uvq04-fan label:hover {
  --y: -.35em;
}

.uvq04-fan label:has(input:checked) {
  --y: -1.3em;
  z-index: 10;
}

.uvq04-fan input:checked + .sw {
  box-shadow: 0 0 0 1px rgba(0,0,0,.1),.2em .6em 1.2em rgba(0,0,0,.3);
}

.uvq04-fan input:checked + .sw .nm {
  color: #111;
}

.uvq04-fan input:focus-visible + .sw {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.uvq04-fan:has(label:nth-of-type(1) input:checked) {
  --pk: #c4673f;
}

.uvq04-fan:has(label:nth-of-type(2) input:checked) {
  --pk: #d9a53a;
}

.uvq04-fan:has(label:nth-of-type(3) input:checked) {
  --pk: #8fa98a;
}

.uvq04-fan:has(label:nth-of-type(4) input:checked) {
  --pk: #2f6f8f;
}

.uvq04-fan:has(label:nth-of-type(5) input:checked) {
  --pk: #6e3a5e;
}

.uvq04-fan:has(label:nth-of-type(6) input:checked) {
  --pk: #aab4c0;
}

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

### React

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

const css = `
.uvq04-fan {
  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;
  width: 19em;
  padding: 1em .5em .4em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--pk,#8fa98a) 22%,var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: .2em;
  text-align: center;
  font-weight: 700;
}

.uvq04-fan .fn {
  clear: both;
  position: relative;
  height: 11.6em;
}

.uvq04-fan label {
  position: absolute;
  left: 50%;
  bottom: .6em;
  width: 2.3em;
  height: 9.8em;
  margin-left: -1.15em;
  transform-origin: 50% calc(100% - 1.1em);
  transform: rotate(var(--a)) translateY(var(--y,0));
  cursor: pointer;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq04-fan .sw {
  position: absolute;
  inset: 0;
  border-radius: .35em;
  background: linear-gradient(color-mix(in srgb,var(--c),#fff 50%) 0 22%,color-mix(in srgb,var(--c),#fff 25%) 0 44%,var(--c) 0 70%,#fbfaf6 0);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08),.1em .25em .5em rgba(0,0,0,.18);
  transition: box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan .nm {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.9em;
  display: flex;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .5em;
  letter-spacing: .04em;
  white-space: nowrap;
  color: #4b4b4b;
}

.uvq04-fan .nm b {
  margin-bottom: .4em;
}

.uvq04-fan .rv {
  position: absolute;
  left: 50%;
  bottom: 1.2em;
  width: .9em;
  height: .9em;
  margin: 0 0 -.45em -.45em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,#f2f2f2,#8d8d8d 60%,#5b5b5b);
  box-shadow: 0 .1em .2em rgba(0,0,0,.4);
  z-index: 20;
}

.uvq04-fan label:hover {
  --y: -.35em;
}

.uvq04-fan label:has(input:checked) {
  --y: -1.3em;
  z-index: 10;
}

.uvq04-fan input:checked + .sw {
  box-shadow: 0 0 0 1px rgba(0,0,0,.1),.2em .6em 1.2em rgba(0,0,0,.3);
}

.uvq04-fan input:checked + .sw .nm {
  color: #111;
}

.uvq04-fan input:focus-visible + .sw {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.uvq04-fan:has(label:nth-of-type(1) input:checked) {
  --pk: #c4673f;
}

.uvq04-fan:has(label:nth-of-type(2) input:checked) {
  --pk: #d9a53a;
}

.uvq04-fan:has(label:nth-of-type(3) input:checked) {
  --pk: #8fa98a;
}

.uvq04-fan:has(label:nth-of-type(4) input:checked) {
  --pk: #2f6f8f;
}

.uvq04-fan:has(label:nth-of-type(5) input:checked) {
  --pk: #6e3a5e;
}

.uvq04-fan:has(label:nth-of-type(6) input:checked) {
  --pk: #aab4c0;
}

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

export default function RdFanDeck() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#2b2b2b",
          "--c2": "#d9d4ca",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-fan"><legend>Wall colour</legend><div className="fn"><label style={{ "--a": "-50deg", "--c": "#c4673f" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Clay</b> R-214</span></span></label><label style={{ "--a": "-30deg", "--c": "#d9a53a" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Mustard</b> Y-108</span></span></label><label style={{ "--a": "-10deg", "--c": "#8fa98a" } as CSSProperties}><input type="radio" name="uvq04-fan" checked={true} /><span className="sw"><span className="nm"><b>Sage</b> G-322</span></span></label><label style={{ "--a": "10deg", "--c": "#2f6f8f" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Ocean</b> B-517</span></span></label><label style={{ "--a": "30deg", "--c": "#6e3a5e" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Plum</b> V-640</span></span></label><label style={{ "--a": "50deg", "--c": "#aab4c0" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Fog</b> N-090</span></span></label><i className="rv" aria-hidden="true"></i></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 “Paint swatch fan deck” block (Radio buttons) from AIMRAN Library to my project.

## What it is
A paint swatch deck opened like a fan: the chosen strip slides out and tints the wall behind it.

## Chosen settings
- Main color: #2b2b2b
- Secondary color: #d9d4ca
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Color de pared"

## 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-fan {
  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;
  width: 19em;
  padding: 1em .5em .4em;
  border-radius: 1.4em;
  background: color-mix(in srgb,var(--pk,#8fa98a) 22%,var(--bg));
  box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--fg) 8%,transparent);
  transition: background calc(0.6s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: .2em;
  text-align: center;
  font-weight: 700;
}

.uvq04-fan .fn {
  clear: both;
  position: relative;
  height: 11.6em;
}

.uvq04-fan label {
  position: absolute;
  left: 50%;
  bottom: .6em;
  width: 2.3em;
  height: 9.8em;
  margin-left: -1.15em;
  transform-origin: 50% calc(100% - 1.1em);
  transform: rotate(var(--a)) translateY(var(--y,0));
  cursor: pointer;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

.uvq04-fan .sw {
  position: absolute;
  inset: 0;
  border-radius: .35em;
  background: linear-gradient(color-mix(in srgb,var(--c),#fff 50%) 0 22%,color-mix(in srgb,var(--c),#fff 25%) 0 44%,var(--c) 0 70%,#fbfaf6 0);
  box-shadow: 0 0 0 1px rgba(0,0,0,.08),.1em .25em .5em rgba(0,0,0,.18);
  transition: box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq04-fan .nm {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 1.9em;
  display: flex;
  justify-content: center;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .5em;
  letter-spacing: .04em;
  white-space: nowrap;
  color: #4b4b4b;
}

.uvq04-fan .nm b {
  margin-bottom: .4em;
}

.uvq04-fan .rv {
  position: absolute;
  left: 50%;
  bottom: 1.2em;
  width: .9em;
  height: .9em;
  margin: 0 0 -.45em -.45em;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%,#f2f2f2,#8d8d8d 60%,#5b5b5b);
  box-shadow: 0 .1em .2em rgba(0,0,0,.4);
  z-index: 20;
}

.uvq04-fan label:hover {
  --y: -.35em;
}

.uvq04-fan label:has(input:checked) {
  --y: -1.3em;
  z-index: 10;
}

.uvq04-fan input:checked + .sw {
  box-shadow: 0 0 0 1px rgba(0,0,0,.1),.2em .6em 1.2em rgba(0,0,0,.3);
}

.uvq04-fan input:checked + .sw .nm {
  color: #111;
}

.uvq04-fan input:focus-visible + .sw {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

.uvq04-fan:has(label:nth-of-type(1) input:checked) {
  --pk: #c4673f;
}

.uvq04-fan:has(label:nth-of-type(2) input:checked) {
  --pk: #d9a53a;
}

.uvq04-fan:has(label:nth-of-type(3) input:checked) {
  --pk: #8fa98a;
}

.uvq04-fan:has(label:nth-of-type(4) input:checked) {
  --pk: #2f6f8f;
}

.uvq04-fan:has(label:nth-of-type(5) input:checked) {
  --pk: #6e3a5e;
}

.uvq04-fan:has(label:nth-of-type(6) input:checked) {
  --pk: #aab4c0;
}

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

export default function RdFanDeck() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#2b2b2b",
          "--c2": "#d9d4ca",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <fieldset className="uvq04-fan"><legend>Wall colour</legend><div className="fn"><label style={{ "--a": "-50deg", "--c": "#c4673f" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Clay</b> R-214</span></span></label><label style={{ "--a": "-30deg", "--c": "#d9a53a" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Mustard</b> Y-108</span></span></label><label style={{ "--a": "-10deg", "--c": "#8fa98a" } as CSSProperties}><input type="radio" name="uvq04-fan" checked={true} /><span className="sw"><span className="nm"><b>Sage</b> G-322</span></span></label><label style={{ "--a": "10deg", "--c": "#2f6f8f" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Ocean</b> B-517</span></span></label><label style={{ "--a": "30deg", "--c": "#6e3a5e" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Plum</b> V-640</span></span></label><label style={{ "--a": "50deg", "--c": "#aab4c0" } as CSSProperties}><input type="radio" name="uvq04-fan" /><span className="sw"><span className="nm"><b>Fog</b> N-090</span></span></label><i className="rv" aria-hidden="true"></i></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.
````
