# Cross-stitch checkbox

> A wooden embroidery hoop with grid fabric where the tick is sewn in, one cross stitch at a time.

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

## Where to use it

Instead of drawing a line, this checkbox embroiders its tick. The box is a wooden hoop with a metal clamp holding gridded fabric, and checking it fills seven cross stitches one after another in thread color. It is HTML and CSS with no images, a warm, handmade touch for craft shops, DIY tutorials, gift lists and slow living brands.

The main color is the thread and the secondary color the fabric, so red on cream, navy on linen or gold on black all work. Use it for one meaningful option rather than a long list, where the stitching would feel slow.

## Code

### HTML

```html
<label class="uvq02-xst"><input type="checkbox"><span class="hp" aria-hidden="true"><span class="cl"><b style="--x:1;--y:4;--i:0"></b><b style="--x:2;--y:5;--i:1"></b><b style="--x:3;--y:6;--i:2"></b><b style="--x:4;--y:5;--i:3"></b><b style="--x:5;--y:4;--i:4"></b><b style="--x:6;--y:3;--i:5"></b><b style="--x:7;--y:2;--i:6"></b></span></span>Handmade gift</label>
```

### CSS

```css
.uvq02-xst {
  --c1: #c8283c;
  --c2: #f4efe4;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq02-xst {
  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: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .9em;
}

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

.uvq02-xst .hp {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 3.95em;
  height: 3.95em;
  border-radius: 50%;
  background: conic-gradient(from 20deg,#c08a4f,#e6bb84,#b37b40,#e2b47a,#a96f36,#c08a4f);
  box-shadow: inset 0 0 0 .08em rgba(0,0,0,.18),0 .3em .6em -.2em rgba(0,0,0,.45);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-xst .hp::before {
  content: "";
  position: absolute;
  top: -.3em;
  left: 50%;
  width: .8em;
  height: .5em;
  margin-left: -.4em;
  border-radius: .12em;
  background: linear-gradient(90deg,#8c8c8c,#e4e4e4,#8c8c8c);
  box-shadow: 0 .08em .1em rgba(0,0,0,.35);
}

.uvq02-xst .cl {
  --p: .36em;
  position: relative;
  width: calc(var(--p) * 9);
  height: calc(var(--p) * 9);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle,rgba(0,0,0,.2) .035em,transparent .055em) calc(var(--p) / -2) calc(var(--p) / -2)/var(--p) var(--p),var(--c2);
  box-shadow: inset 0 .15em .3em rgba(0,0,0,.22);
}

.uvq02-xst b {
  position: absolute;
  left: calc(var(--x) * var(--p));
  top: calc(var(--y) * var(--p));
  width: var(--p);
  height: var(--p);
  background: linear-gradient(45deg,transparent 36%,var(--c1) 36% 64%,transparent 64%),linear-gradient(-45deg,transparent 34%,color-mix(in srgb,var(--c1) 78%,#fff) 34% 66%,transparent 66%);
  filter: drop-shadow(0 .03em 0 rgba(0,0,0,.3));
  opacity: 0;
  transform: scale(.2) rotate(-45deg);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1) calc(var(--i) * calc(0.07s / var(--k))),opacity calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.07s / var(--k)));
}

.uvq02-xst:hover .hp {
  transform: rotate(-8deg);
}

.uvq02-xst:active .hp {
  transform: rotate(-8deg) scale(.94);
}

.uvq02-xst input:checked + .hp b {
  opacity: 1;
  transform: none;
}

.uvq02-xst input:focus-visible + .hp {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

### React

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

const css = `
.uvq02-xst {
  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: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .9em;
}

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

.uvq02-xst .hp {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 3.95em;
  height: 3.95em;
  border-radius: 50%;
  background: conic-gradient(from 20deg,#c08a4f,#e6bb84,#b37b40,#e2b47a,#a96f36,#c08a4f);
  box-shadow: inset 0 0 0 .08em rgba(0,0,0,.18),0 .3em .6em -.2em rgba(0,0,0,.45);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-xst .hp::before {
  content: "";
  position: absolute;
  top: -.3em;
  left: 50%;
  width: .8em;
  height: .5em;
  margin-left: -.4em;
  border-radius: .12em;
  background: linear-gradient(90deg,#8c8c8c,#e4e4e4,#8c8c8c);
  box-shadow: 0 .08em .1em rgba(0,0,0,.35);
}

.uvq02-xst .cl {
  --p: .36em;
  position: relative;
  width: calc(var(--p) * 9);
  height: calc(var(--p) * 9);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle,rgba(0,0,0,.2) .035em,transparent .055em) calc(var(--p) / -2) calc(var(--p) / -2)/var(--p) var(--p),var(--c2);
  box-shadow: inset 0 .15em .3em rgba(0,0,0,.22);
}

.uvq02-xst b {
  position: absolute;
  left: calc(var(--x) * var(--p));
  top: calc(var(--y) * var(--p));
  width: var(--p);
  height: var(--p);
  background: linear-gradient(45deg,transparent 36%,var(--c1) 36% 64%,transparent 64%),linear-gradient(-45deg,transparent 34%,color-mix(in srgb,var(--c1) 78%,#fff) 34% 66%,transparent 66%);
  filter: drop-shadow(0 .03em 0 rgba(0,0,0,.3));
  opacity: 0;
  transform: scale(.2) rotate(-45deg);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1) calc(var(--i) * calc(0.07s / var(--k))),opacity calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.07s / var(--k)));
}

.uvq02-xst:hover .hp {
  transform: rotate(-8deg);
}

.uvq02-xst:active .hp {
  transform: rotate(-8deg) scale(.94);
}

.uvq02-xst input:checked + .hp b {
  opacity: 1;
  transform: none;
}

.uvq02-xst input:focus-visible + .hp {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkStitch() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c8283c",
          "--c2": "#f4efe4",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-xst"><input type="checkbox" /><span className="hp" aria-hidden="true"><span className="cl"><b style={{ "--x": "1", "--y": "4", "--i": "0" } as CSSProperties}></b><b style={{ "--x": "2", "--y": "5", "--i": "1" } as CSSProperties}></b><b style={{ "--x": "3", "--y": "6", "--i": "2" } as CSSProperties}></b><b style={{ "--x": "4", "--y": "5", "--i": "3" } as CSSProperties}></b><b style={{ "--x": "5", "--y": "4", "--i": "4" } as CSSProperties}></b><b style={{ "--x": "6", "--y": "3", "--i": "5" } as CSSProperties}></b><b style={{ "--x": "7", "--y": "2", "--i": "6" } as CSSProperties}></b></span></span>Handmade gift</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 “Cross-stitch checkbox” block (Checkboxes) from AIMRAN Library to my project.

## What it is
A wooden embroidery hoop with grid fabric where the tick is sewn in, one cross stitch at a time.

## Chosen settings
- Main color: #c8283c
- Secondary color: #f4efe4
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Regalo hecho a mano"

## 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 = `
.uvq02-xst {
  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: .75em;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  font-weight: 550;
  gap: .9em;
}

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

.uvq02-xst .hp {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 3.95em;
  height: 3.95em;
  border-radius: 50%;
  background: conic-gradient(from 20deg,#c08a4f,#e6bb84,#b37b40,#e2b47a,#a96f36,#c08a4f);
  box-shadow: inset 0 0 0 .08em rgba(0,0,0,.18),0 .3em .6em -.2em rgba(0,0,0,.45);
  transition: transform calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-xst .hp::before {
  content: "";
  position: absolute;
  top: -.3em;
  left: 50%;
  width: .8em;
  height: .5em;
  margin-left: -.4em;
  border-radius: .12em;
  background: linear-gradient(90deg,#8c8c8c,#e4e4e4,#8c8c8c);
  box-shadow: 0 .08em .1em rgba(0,0,0,.35);
}

.uvq02-xst .cl {
  --p: .36em;
  position: relative;
  width: calc(var(--p) * 9);
  height: calc(var(--p) * 9);
  border-radius: 50%;
  overflow: hidden;
  background: radial-gradient(circle,rgba(0,0,0,.2) .035em,transparent .055em) calc(var(--p) / -2) calc(var(--p) / -2)/var(--p) var(--p),var(--c2);
  box-shadow: inset 0 .15em .3em rgba(0,0,0,.22);
}

.uvq02-xst b {
  position: absolute;
  left: calc(var(--x) * var(--p));
  top: calc(var(--y) * var(--p));
  width: var(--p);
  height: var(--p);
  background: linear-gradient(45deg,transparent 36%,var(--c1) 36% 64%,transparent 64%),linear-gradient(-45deg,transparent 34%,color-mix(in srgb,var(--c1) 78%,#fff) 34% 66%,transparent 66%);
  filter: drop-shadow(0 .03em 0 rgba(0,0,0,.3));
  opacity: 0;
  transform: scale(.2) rotate(-45deg);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1) calc(var(--i) * calc(0.07s / var(--k))),opacity calc(0.15s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(var(--i) * calc(0.07s / var(--k)));
}

.uvq02-xst:hover .hp {
  transform: rotate(-8deg);
}

.uvq02-xst:active .hp {
  transform: rotate(-8deg) scale(.94);
}

.uvq02-xst input:checked + .hp b {
  opacity: 1;
  transform: none;
}

.uvq02-xst input:focus-visible + .hp {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function ChkStitch() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#c8283c",
          "--c2": "#f4efe4",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-xst"><input type="checkbox" /><span className="hp" aria-hidden="true"><span className="cl"><b style={{ "--x": "1", "--y": "4", "--i": "0" } as CSSProperties}></b><b style={{ "--x": "2", "--y": "5", "--i": "1" } as CSSProperties}></b><b style={{ "--x": "3", "--y": "6", "--i": "2" } as CSSProperties}></b><b style={{ "--x": "4", "--y": "5", "--i": "3" } as CSSProperties}></b><b style={{ "--x": "5", "--y": "4", "--i": "4" } as CSSProperties}></b><b style={{ "--x": "6", "--y": "3", "--i": "5" } as CSSProperties}></b><b style={{ "--x": "7", "--y": "2", "--i": "6" } as CSSProperties}></b></span></span>Handmade gift</label>
      </div>
    </>
  );
}
```

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