# Hand-circled yes or no toggle

> A question and two words on a notepad: a marker draws a loose loop around the chosen answer.

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

## Where to use it

Here the switch is a scrap of lined notepad with Yes and No written in a handwriting font. The current answer is circled with a loose red marker loop that draws itself, while the other loop wipes away, so the choice reads like a note on paper. The loops are SVG paths animated with stroke-dashoffset. It suits surveys, newsletter opt-ins, quizzes and friendly forms.

The main color is the marker and the second one is the ruled lines. Change the question in the text field and keep it short; the handwriting font comes from the system, so it varies a little between devices.

## Code

### HTML

```html
<label class="uvq03-skt"><input type="checkbox" role="switch"><span class="q">Get the newsletter?</span><span class="nb"><span class="o y">Yes<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M44 6C30 1 8 4 5 16c-3 12 18 17 33 15 14-2 20-10 15-18C49 6 36 4 26 6" pathLength="1"/></svg></span><span class="o n">No<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M16 5C30 1 54 5 55 17c1 11-20 16-34 13C8 27 2 20 7 12c4-6 16-8 28-7" pathLength="1"/></svg></span></span></label>
```

### CSS

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

.uvq03-skt {
  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;
  gap: .7em;
  font-weight: 600;
}

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

.uvq03-skt .nb {
  position: relative;
  display: inline-flex;
  gap: .2em;
  padding: .3em .45em;
  border-radius: .3em;
  color: #2b2b33;
  background: repeating-linear-gradient(180deg,transparent 0 .95em,color-mix(in srgb,var(--c2) 65%,transparent) .95em calc(.95em + 1px)),#fffef8;
  box-shadow: 0 0 0 1px rgba(0,0,0,.07),0 .35em .7em -.4em rgba(0,0,0,.4);
  transform: rotate(-1.5deg);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-skt .o {
  position: relative;
  display: grid;
  place-items: center;
  width: 2em;
  height: 1.4em;
  font: 700 1.15em/1 "Segoe Print","Bradley Hand","Chalkboard SE","Comic Sans MS",cursive;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-skt .y {
  opacity: .45;
}

.uvq03-skt svg {
  position: absolute;
  left: -.3em;
  top: -.25em;
  width: calc(100% + .6em);
  height: calc(100% + .5em);
  overflow: visible;
  pointer-events: none;
}

.uvq03-skt path {
  fill: none;
  stroke: var(--c1);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt .n path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt:hover .nb {
  transform: rotate(0deg);
}

.uvq03-skt:active .nb {
  transform: rotate(0deg) scale(.96);
}

.uvq03-skt input:checked ~ .nb .y {
  opacity: 1;
}

.uvq03-skt input:checked ~ .nb .n {
  opacity: .45;
}

.uvq03-skt input:checked ~ .nb .y path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt input:checked ~ .nb .n path {
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt input:focus-visible ~ .nb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

### React

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

const css = `
.uvq03-skt {
  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;
  gap: .7em;
  font-weight: 600;
}

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

.uvq03-skt .nb {
  position: relative;
  display: inline-flex;
  gap: .2em;
  padding: .3em .45em;
  border-radius: .3em;
  color: #2b2b33;
  background: repeating-linear-gradient(180deg,transparent 0 .95em,color-mix(in srgb,var(--c2) 65%,transparent) .95em calc(.95em + 1px)),#fffef8;
  box-shadow: 0 0 0 1px rgba(0,0,0,.07),0 .35em .7em -.4em rgba(0,0,0,.4);
  transform: rotate(-1.5deg);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-skt .o {
  position: relative;
  display: grid;
  place-items: center;
  width: 2em;
  height: 1.4em;
  font: 700 1.15em/1 "Segoe Print","Bradley Hand","Chalkboard SE","Comic Sans MS",cursive;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-skt .y {
  opacity: .45;
}

.uvq03-skt svg {
  position: absolute;
  left: -.3em;
  top: -.25em;
  width: calc(100% + .6em);
  height: calc(100% + .5em);
  overflow: visible;
  pointer-events: none;
}

.uvq03-skt path {
  fill: none;
  stroke: var(--c1);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt .n path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt:hover .nb {
  transform: rotate(0deg);
}

.uvq03-skt:active .nb {
  transform: rotate(0deg) scale(.96);
}

.uvq03-skt input:checked ~ .nb .y {
  opacity: 1;
}

.uvq03-skt input:checked ~ .nb .n {
  opacity: .45;
}

.uvq03-skt input:checked ~ .nb .y path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt input:checked ~ .nb .n path {
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt input:focus-visible ~ .nb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function TgSketchYesNo() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#e23d3d",
          "--c2": "#7fb0e0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-skt"><input type="checkbox" role="switch" /><span className="q">Get the newsletter?</span><span className="nb"><span className="o y">Yes<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M44 6C30 1 8 4 5 16c-3 12 18 17 33 15 14-2 20-10 15-18C49 6 36 4 26 6" pathLength="1" /></svg></span><span className="o n">No<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M16 5C30 1 54 5 55 17c1 11-20 16-34 13C8 27 2 20 7 12c4-6 16-8 28-7" pathLength="1" /></svg></span></span></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 “Hand-circled yes or no toggle” block (Toggles) from AIMRAN Library to my project.

## What it is
A question and two words on a notepad: a marker draws a loose loop around the chosen answer.

## Chosen settings
- Main color: #e23d3d
- Secondary color: #7fb0e0
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "¿Recibir el boletí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-skt {
  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;
  gap: .7em;
  font-weight: 600;
}

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

.uvq03-skt .nb {
  position: relative;
  display: inline-flex;
  gap: .2em;
  padding: .3em .45em;
  border-radius: .3em;
  color: #2b2b33;
  background: repeating-linear-gradient(180deg,transparent 0 .95em,color-mix(in srgb,var(--c2) 65%,transparent) .95em calc(.95em + 1px)),#fffef8;
  box-shadow: 0 0 0 1px rgba(0,0,0,.07),0 .35em .7em -.4em rgba(0,0,0,.4);
  transform: rotate(-1.5deg);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq03-skt .o {
  position: relative;
  display: grid;
  place-items: center;
  width: 2em;
  height: 1.4em;
  font: 700 1.15em/1 "Segoe Print","Bradley Hand","Chalkboard SE","Comic Sans MS",cursive;
  transition: opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq03-skt .y {
  opacity: .45;
}

.uvq03-skt svg {
  position: absolute;
  left: -.3em;
  top: -.25em;
  width: calc(100% + .6em);
  height: calc(100% + .5em);
  overflow: visible;
  pointer-events: none;
}

.uvq03-skt path {
  fill: none;
  stroke: var(--c1);
  stroke-width: 2.6;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt .n path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt:hover .nb {
  transform: rotate(0deg);
}

.uvq03-skt:active .nb {
  transform: rotate(0deg) scale(.96);
}

.uvq03-skt input:checked ~ .nb .y {
  opacity: 1;
}

.uvq03-skt input:checked ~ .nb .n {
  opacity: .45;
}

.uvq03-skt input:checked ~ .nb .y path {
  stroke-dashoffset: 0;
  opacity: 1;
  transition: stroke-dashoffset calc(0.5s / var(--k)) cubic-bezier(.5,0,.3,1) calc(0.15s / var(--k)),opacity 0s linear calc(0.15s / var(--k));
}

.uvq03-skt input:checked ~ .nb .n path {
  stroke-dashoffset: 1;
  opacity: 0;
  transition: stroke-dashoffset calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity 0s linear calc(0.2s / var(--k));
}

.uvq03-skt input:focus-visible ~ .nb {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

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

export default function TgSketchYesNo() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#e23d3d",
          "--c2": "#7fb0e0",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq03-skt"><input type="checkbox" role="switch" /><span className="q">Get the newsletter?</span><span className="nb"><span className="o y">Yes<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M44 6C30 1 8 4 5 16c-3 12 18 17 33 15 14-2 20-10 15-18C49 6 36 4 26 6" pathLength="1" /></svg></span><span className="o n">No<svg viewBox="0 0 60 36" aria-hidden="true"><path d="M16 5C30 1 54 5 55 17c1 11-20 16-34 13C8 27 2 20 7 12c4-6 16-8 28-7" pathLength="1" /></svg></span></span></label>
      </div>
    </>
  );
}
```

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