# Zipper toggle

> The pull slides across a denim patch and the brass teeth lock together one by one behind it.

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

## Where to use it

This switch is a real zipper in miniature: a patch of denim with dashed stitching, two rows of brass teeth and a metal pull with a dangling tab. Turning it on moves the pull to the right while each tooth closes with a small delay, so the zip seals behind it. The tab swings when it stops. It fits privacy settings, locked folders and fashion or outdoor brands.

The main color is the fabric and the second one is the metal of the teeth. Try olive canvas with silver teeth or black leather with gold, and keep the label short because the zipper is already wide.

## Code

### HTML

```html
<label class="uvq03-zip"><input type="checkbox" role="switch"><span class="fb"><span class="tt"><i style="--i:0"></i><i style="--i:1"></i><i style="--i:2"></i><i style="--i:3"></i><i style="--i:4"></i><i style="--i:5"></i><i style="--i:6"></i><i style="--i:7"></i><i style="--i:8"></i><i style="--i:9"></i><i style="--i:10"></i></span><span class="tb"><i style="--i:0"></i><i style="--i:1"></i><i style="--i:2"></i><i style="--i:3"></i><i style="--i:4"></i><i style="--i:5"></i><i style="--i:6"></i><i style="--i:7"></i><i style="--i:8"></i><i style="--i:9"></i><i style="--i:10"></i></span><span class="pl"><i></i></span></span>Private mode</label>
```

### CSS

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

.uvq03-zip {
  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-zip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-zip .fb {
  position: relative;
  display: block;
  flex: none;
  width: 5.4em;
  height: 2.1em;
  border-radius: .45em;
  background: repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 .07em,transparent .07em .18em),repeating-linear-gradient(-45deg,rgba(0,0,0,.14) 0 .07em,transparent .07em .18em),var(--c1);
  box-shadow: inset 0 .1em .2em rgba(255,255,255,.12),0 .45em .8em -.45em rgba(0,0,0,.5);
}

.uvq03-zip .fb::before {
  content: "";
  position: absolute;
  inset: .17em;
  border: 1.5px dashed rgba(255,226,170,.6);
  border-radius: .32em;
}

.uvq03-zip .fb::after {
  content: "";
  position: absolute;
  left: .35em;
  right: .35em;
  top: 50%;
  height: .5em;
  margin-top: -.25em;
  border-radius: .2em;
  background: #161a24;
  box-shadow: inset 0 .08em .15em #000;
  transform-origin: 100% 50%;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .tt,.uvq03-zip .tb {
  position: absolute;
  left: .45em;
  right: .45em;
  top: 50%;
  z-index: 1;
}

.uvq03-zip .tt i,.uvq03-zip .tb i {
  position: absolute;
  width: .26em;
  height: .3em;
  border-radius: .07em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c2) 65%,#fff),var(--c2) 50%,color-mix(in srgb,var(--c2) 65%,#000));
  box-shadow: 0 .04em .06em rgba(0,0,0,.4);
  transition: transform calc(0.22s / var(--k)) cubic-bezier(.25,.1,.25,1);
  transition-delay: calc((10 - var(--i)) * calc(0.035s / var(--k)));
}

.uvq03-zip .tt i {
  left: calc(var(--i) * .42em);
  top: -.31em;
  transform: translateY(-.2em);
}

.uvq03-zip .tb i {
  left: calc(var(--i) * .42em + .21em);
  top: .01em;
  transform: translateY(.2em);
}

.uvq03-zip .pl {
  position: absolute;
  left: .1em;
  top: 50%;
  z-index: 2;
  width: .62em;
  height: .8em;
  margin-top: -.4em;
  border-radius: .22em .22em .3em .3em;
  background: linear-gradient(90deg,#a87f25,#f4dc94 45%,#9c7420);
  box-shadow: 0 .1em .2em rgba(0,0,0,.5);
  transition: left calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .pl i {
  position: absolute;
  left: 50%;
  top: .5em;
  width: .42em;
  height: 1em;
  margin-left: -.21em;
  border-radius: .12em .12em .22em .22em;
  background: linear-gradient(90deg,#9c7420,#f4dc94 50%,#9c7420);
  -webkit-mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  transform-origin: 50% 0;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-zip:hover .pl i {
  transform: rotate(-12deg);
}

.uvq03-zip:active .pl {
  scale: .92;
}

.uvq03-zip input:checked + .fb::after {
  transform: scaleX(0);
}

.uvq03-zip input:checked + .fb .tt i,.uvq03-zip input:checked + .fb .tb i {
  transform: none;
  transition-delay: calc(var(--i) * calc(0.035s / var(--k)));
}

.uvq03-zip input:checked + .fb .pl {
  left: calc(100% - .72em);
}

.uvq03-zip input:checked + .fb .pl i {
  animation: uvq03-zip calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-zip {
  25% {
    transform: rotate(28deg);
  }
  55% {
    transform: rotate(-14deg);
  }
  80% {
    transform: rotate(6deg);
  }
}

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

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

### React

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

const css = `
.uvq03-zip {
  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-zip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-zip .fb {
  position: relative;
  display: block;
  flex: none;
  width: 5.4em;
  height: 2.1em;
  border-radius: .45em;
  background: repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 .07em,transparent .07em .18em),repeating-linear-gradient(-45deg,rgba(0,0,0,.14) 0 .07em,transparent .07em .18em),var(--c1);
  box-shadow: inset 0 .1em .2em rgba(255,255,255,.12),0 .45em .8em -.45em rgba(0,0,0,.5);
}

.uvq03-zip .fb::before {
  content: "";
  position: absolute;
  inset: .17em;
  border: 1.5px dashed rgba(255,226,170,.6);
  border-radius: .32em;
}

.uvq03-zip .fb::after {
  content: "";
  position: absolute;
  left: .35em;
  right: .35em;
  top: 50%;
  height: .5em;
  margin-top: -.25em;
  border-radius: .2em;
  background: #161a24;
  box-shadow: inset 0 .08em .15em #000;
  transform-origin: 100% 50%;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .tt,.uvq03-zip .tb {
  position: absolute;
  left: .45em;
  right: .45em;
  top: 50%;
  z-index: 1;
}

.uvq03-zip .tt i,.uvq03-zip .tb i {
  position: absolute;
  width: .26em;
  height: .3em;
  border-radius: .07em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c2) 65%,#fff),var(--c2) 50%,color-mix(in srgb,var(--c2) 65%,#000));
  box-shadow: 0 .04em .06em rgba(0,0,0,.4);
  transition: transform calc(0.22s / var(--k)) cubic-bezier(.25,.1,.25,1);
  transition-delay: calc((10 - var(--i)) * calc(0.035s / var(--k)));
}

.uvq03-zip .tt i {
  left: calc(var(--i) * .42em);
  top: -.31em;
  transform: translateY(-.2em);
}

.uvq03-zip .tb i {
  left: calc(var(--i) * .42em + .21em);
  top: .01em;
  transform: translateY(.2em);
}

.uvq03-zip .pl {
  position: absolute;
  left: .1em;
  top: 50%;
  z-index: 2;
  width: .62em;
  height: .8em;
  margin-top: -.4em;
  border-radius: .22em .22em .3em .3em;
  background: linear-gradient(90deg,#a87f25,#f4dc94 45%,#9c7420);
  box-shadow: 0 .1em .2em rgba(0,0,0,.5);
  transition: left calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .pl i {
  position: absolute;
  left: 50%;
  top: .5em;
  width: .42em;
  height: 1em;
  margin-left: -.21em;
  border-radius: .12em .12em .22em .22em;
  background: linear-gradient(90deg,#9c7420,#f4dc94 50%,#9c7420);
  -webkit-mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  transform-origin: 50% 0;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-zip:hover .pl i {
  transform: rotate(-12deg);
}

.uvq03-zip:active .pl {
  scale: .92;
}

.uvq03-zip input:checked + .fb::after {
  transform: scaleX(0);
}

.uvq03-zip input:checked + .fb .tt i,.uvq03-zip input:checked + .fb .tb i {
  transform: none;
  transition-delay: calc(var(--i) * calc(0.035s / var(--k)));
}

.uvq03-zip input:checked + .fb .pl {
  left: calc(100% - .72em);
}

.uvq03-zip input:checked + .fb .pl i {
  animation: uvq03-zip calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-zip {
  25% {
    transform: rotate(28deg);
  }
  55% {
    transform: rotate(-14deg);
  }
  80% {
    transform: rotate(6deg);
  }
}

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

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

export default function TgZipper() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#34507e",
          "--c2": "#d6b05a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-zip"><input type="checkbox" role="switch" /><span className="fb"><span className="tt"><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i><i style={{ "--i": "6" } as CSSProperties}></i><i style={{ "--i": "7" } as CSSProperties}></i><i style={{ "--i": "8" } as CSSProperties}></i><i style={{ "--i": "9" } as CSSProperties}></i><i style={{ "--i": "10" } as CSSProperties}></i></span><span className="tb"><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i><i style={{ "--i": "6" } as CSSProperties}></i><i style={{ "--i": "7" } as CSSProperties}></i><i style={{ "--i": "8" } as CSSProperties}></i><i style={{ "--i": "9" } as CSSProperties}></i><i style={{ "--i": "10" } as CSSProperties}></i></span><span className="pl"><i></i></span></span>Private mode</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 “Zipper toggle” block (Toggles) from AIMRAN Library to my project.

## What it is
The pull slides across a denim patch and the brass teeth lock together one by one behind it.

## Chosen settings
- Main color: #34507e
- Secondary color: #d6b05a
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Modo privado"

## 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-zip {
  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-zip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  margin: 0;
  pointer-events: none;
}

.uvq03-zip .fb {
  position: relative;
  display: block;
  flex: none;
  width: 5.4em;
  height: 2.1em;
  border-radius: .45em;
  background: repeating-linear-gradient(45deg,rgba(255,255,255,.08) 0 .07em,transparent .07em .18em),repeating-linear-gradient(-45deg,rgba(0,0,0,.14) 0 .07em,transparent .07em .18em),var(--c1);
  box-shadow: inset 0 .1em .2em rgba(255,255,255,.12),0 .45em .8em -.45em rgba(0,0,0,.5);
}

.uvq03-zip .fb::before {
  content: "";
  position: absolute;
  inset: .17em;
  border: 1.5px dashed rgba(255,226,170,.6);
  border-radius: .32em;
}

.uvq03-zip .fb::after {
  content: "";
  position: absolute;
  left: .35em;
  right: .35em;
  top: 50%;
  height: .5em;
  margin-top: -.25em;
  border-radius: .2em;
  background: #161a24;
  box-shadow: inset 0 .08em .15em #000;
  transform-origin: 100% 50%;
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .tt,.uvq03-zip .tb {
  position: absolute;
  left: .45em;
  right: .45em;
  top: 50%;
  z-index: 1;
}

.uvq03-zip .tt i,.uvq03-zip .tb i {
  position: absolute;
  width: .26em;
  height: .3em;
  border-radius: .07em;
  background: linear-gradient(90deg,color-mix(in srgb,var(--c2) 65%,#fff),var(--c2) 50%,color-mix(in srgb,var(--c2) 65%,#000));
  box-shadow: 0 .04em .06em rgba(0,0,0,.4);
  transition: transform calc(0.22s / var(--k)) cubic-bezier(.25,.1,.25,1);
  transition-delay: calc((10 - var(--i)) * calc(0.035s / var(--k)));
}

.uvq03-zip .tt i {
  left: calc(var(--i) * .42em);
  top: -.31em;
  transform: translateY(-.2em);
}

.uvq03-zip .tb i {
  left: calc(var(--i) * .42em + .21em);
  top: .01em;
  transform: translateY(.2em);
}

.uvq03-zip .pl {
  position: absolute;
  left: .1em;
  top: 50%;
  z-index: 2;
  width: .62em;
  height: .8em;
  margin-top: -.4em;
  border-radius: .22em .22em .3em .3em;
  background: linear-gradient(90deg,#a87f25,#f4dc94 45%,#9c7420);
  box-shadow: 0 .1em .2em rgba(0,0,0,.5);
  transition: left calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1);
}

.uvq03-zip .pl i {
  position: absolute;
  left: 50%;
  top: .5em;
  width: .42em;
  height: 1em;
  margin-left: -.21em;
  border-radius: .12em .12em .22em .22em;
  background: linear-gradient(90deg,#9c7420,#f4dc94 50%,#9c7420);
  -webkit-mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  mask: radial-gradient(circle at 50% 72%,#0000 .08em,#000 .09em);
  transform-origin: 50% 0;
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-zip:hover .pl i {
  transform: rotate(-12deg);
}

.uvq03-zip:active .pl {
  scale: .92;
}

.uvq03-zip input:checked + .fb::after {
  transform: scaleX(0);
}

.uvq03-zip input:checked + .fb .tt i,.uvq03-zip input:checked + .fb .tb i {
  transform: none;
  transition-delay: calc(var(--i) * calc(0.035s / var(--k)));
}

.uvq03-zip input:checked + .fb .pl {
  left: calc(100% - .72em);
}

.uvq03-zip input:checked + .fb .pl i {
  animation: uvq03-zip calc(0.9s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

@keyframes uvq03-zip {
  25% {
    transform: rotate(28deg);
  }
  55% {
    transform: rotate(-14deg);
  }
  80% {
    transform: rotate(6deg);
  }
}

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

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

export default function TgZipper() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#34507e",
          "--c2": "#d6b05a",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-zip"><input type="checkbox" role="switch" /><span className="fb"><span className="tt"><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i><i style={{ "--i": "6" } as CSSProperties}></i><i style={{ "--i": "7" } as CSSProperties}></i><i style={{ "--i": "8" } as CSSProperties}></i><i style={{ "--i": "9" } as CSSProperties}></i><i style={{ "--i": "10" } as CSSProperties}></i></span><span className="tb"><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i><i style={{ "--i": "6" } as CSSProperties}></i><i style={{ "--i": "7" } as CSSProperties}></i><i style={{ "--i": "8" } as CSSProperties}></i><i style={{ "--i": "9" } as CSSProperties}></i><i style={{ "--i": "10" } as CSSProperties}></i></span><span className="pl"><i></i></span></span>Private mode</label>
      </div>
    </>
  );
}
```

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