# Closing circuit checkbox

> A circuit board with a lever switch: checking closes it, current runs along the traces and the LED lights up.

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

## Where to use it

This checkbox is a tiny printed circuit board in inline SVG, with gold traces, a battery, mounting holes and silkscreen labels. Checking it swings the lever switch shut, sends dashes of current running along the traces and lights the LED with a glow. Hover and press move the lever partway. It fits IoT dashboards, hardware product pages, maker tools and settings that connect a device.

The main color is the current and the LED, the secondary color the copper traces and pads. Rename the silkscreen labels to match your component names, and use a dark page so the glow of the LED stands out.

## Code

### HTML

```html
<label class="uvq02-pcb"><input type="checkbox"><span class="bx"><svg viewBox="0 0 72 36" aria-hidden="true"><rect class="bd" width="72" height="36" rx="3.5"/><circle class="ho" cx="4" cy="4" r="1.6"/><circle class="ho" cx="68" cy="4" r="1.6"/><circle class="ho" cx="4" cy="32" r="1.6"/><circle class="ho" cx="68" cy="32" r="1.6"/><g class="tr"><path d="M14 18H24"/><path d="M34 18H44V10H50"/><path d="M58 10H64V29H10V24"/></g><g class="cu"><path d="M14 18H24"/><path d="M34 18H44V10H50"/><path d="M58 10H64V29H10V24"/></g><rect class="bt" x="6" y="12" width="8" height="12" rx="1.2"/><text x="8" y="17">+</text><circle class="pa" cx="24" cy="18" r="2"/><circle class="pa" cx="34" cy="18" r="2"/><line class="lv" x1="24" y1="18" x2="34.5" y2="18"/><circle class="le" cx="54" cy="10" r="4"/><circle class="lh" cx="52.8" cy="8.8" r="1.1"/><text x="25" y="25.5">SW1</text><text x="51.5" y="19">D1</text></svg></span>Connect the sensor</label>
```

### CSS

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

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

.uvq02-pcb .bx {
  display: block;
  flex: none;
  width: 8.4em;
  height: 4.2em;
  border-radius: .45em;
  filter: drop-shadow(0 .35em .5em rgba(0,0,0,.35));
}

.uvq02-pcb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.uvq02-pcb svg * {
  transform-box: view-box;
}

.uvq02-pcb .bd {
  fill: #0e3b2c;
}

.uvq02-pcb .ho {
  fill: #06231a;
  stroke: var(--c2);
  stroke-width: .7;
}

.uvq02-pcb .tr path,.uvq02-pcb .cu path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq02-pcb .tr path {
  stroke: color-mix(in srgb,var(--c2) 80%,#0e3b2c);
}

.uvq02-pcb .cu path {
  stroke: var(--c1);
  stroke-width: 1;
  stroke-dasharray: 1.2 3.4;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .bt {
  fill: #1b1d20;
  stroke: #4a4d52;
  stroke-width: .6;
}

.uvq02-pcb text {
  fill: rgba(255,255,255,.6);
  font: 700 3.2px ui-monospace,Menlo,Consolas,monospace;
}

.uvq02-pcb .bt + text {
  fill: var(--c2);
  font-size: 5px;
}

.uvq02-pcb .pa {
  fill: var(--c2);
}

.uvq02-pcb .lv {
  stroke: #d9dde2;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform-origin: 24px 18px;
  transform: rotate(-34deg);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-pcb .le {
  fill: #2a2d30;
  stroke: #5a5f66;
  stroke-width: .7;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .lh {
  fill: rgba(255,255,255,.35);
}

.uvq02-pcb:hover input:not(:checked) + .bx .lv {
  transform: rotate(-24deg);
}

.uvq02-pcb:active input:not(:checked) + .bx .lv {
  transform: rotate(-10deg);
}

.uvq02-pcb input:checked + .bx .lv {
  transform: none;
}

.uvq02-pcb input:checked + .bx .cu path {
  opacity: 1;
  animation: uvq02-pcb calc(0.7s / var(--k)) linear infinite;
}

.uvq02-pcb input:checked + .bx .le {
  fill: var(--c1);
  filter: drop-shadow(0 0 2.5px var(--c1)) drop-shadow(0 0 6px var(--c1));
}

@keyframes uvq02-pcb {
  to {
    stroke-dashoffset: -4.6;
  }
}

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

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

### React

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

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

.uvq02-pcb .bx {
  display: block;
  flex: none;
  width: 8.4em;
  height: 4.2em;
  border-radius: .45em;
  filter: drop-shadow(0 .35em .5em rgba(0,0,0,.35));
}

.uvq02-pcb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.uvq02-pcb svg * {
  transform-box: view-box;
}

.uvq02-pcb .bd {
  fill: #0e3b2c;
}

.uvq02-pcb .ho {
  fill: #06231a;
  stroke: var(--c2);
  stroke-width: .7;
}

.uvq02-pcb .tr path,.uvq02-pcb .cu path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq02-pcb .tr path {
  stroke: color-mix(in srgb,var(--c2) 80%,#0e3b2c);
}

.uvq02-pcb .cu path {
  stroke: var(--c1);
  stroke-width: 1;
  stroke-dasharray: 1.2 3.4;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .bt {
  fill: #1b1d20;
  stroke: #4a4d52;
  stroke-width: .6;
}

.uvq02-pcb text {
  fill: rgba(255,255,255,.6);
  font: 700 3.2px ui-monospace,Menlo,Consolas,monospace;
}

.uvq02-pcb .bt + text {
  fill: var(--c2);
  font-size: 5px;
}

.uvq02-pcb .pa {
  fill: var(--c2);
}

.uvq02-pcb .lv {
  stroke: #d9dde2;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform-origin: 24px 18px;
  transform: rotate(-34deg);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-pcb .le {
  fill: #2a2d30;
  stroke: #5a5f66;
  stroke-width: .7;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .lh {
  fill: rgba(255,255,255,.35);
}

.uvq02-pcb:hover input:not(:checked) + .bx .lv {
  transform: rotate(-24deg);
}

.uvq02-pcb:active input:not(:checked) + .bx .lv {
  transform: rotate(-10deg);
}

.uvq02-pcb input:checked + .bx .lv {
  transform: none;
}

.uvq02-pcb input:checked + .bx .cu path {
  opacity: 1;
  animation: uvq02-pcb calc(0.7s / var(--k)) linear infinite;
}

.uvq02-pcb input:checked + .bx .le {
  fill: var(--c1);
  filter: drop-shadow(0 0 2.5px var(--c1)) drop-shadow(0 0 6px var(--c1));
}

@keyframes uvq02-pcb {
  to {
    stroke-dashoffset: -4.6;
  }
}

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

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

export default function ChkCircuit() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#3df2c6",
          "--c2": "#e6b450",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-pcb"><input type="checkbox" /><span className="bx"><svg viewBox="0 0 72 36" aria-hidden="true"><rect className="bd" width="72" height="36" rx="3.5" /><circle className="ho" cx="4" cy="4" r="1.6" /><circle className="ho" cx="68" cy="4" r="1.6" /><circle className="ho" cx="4" cy="32" r="1.6" /><circle className="ho" cx="68" cy="32" r="1.6" /><g className="tr"><path d="M14 18H24" /><path d="M34 18H44V10H50" /><path d="M58 10H64V29H10V24" /></g><g className="cu"><path d="M14 18H24" /><path d="M34 18H44V10H50" /><path d="M58 10H64V29H10V24" /></g><rect className="bt" x="6" y="12" width="8" height="12" rx="1.2" /><text x="8" y="17">+</text><circle className="pa" cx="24" cy="18" r="2" /><circle className="pa" cx="34" cy="18" r="2" /><line className="lv" x1="24" y1="18" x2="34.5" y2="18" /><circle className="le" cx="54" cy="10" r="4" /><circle className="lh" cx="52.8" cy="8.8" r="1.1" /><text x="25" y="25.5">SW1</text><text x="51.5" y="19">D1</text></svg></span>Connect the sensor</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 “Closing circuit checkbox” block (Checkboxes) from AIMRAN Library to my project.

## What it is
A circuit board with a lever switch: checking closes it, current runs along the traces and the LED lights up.

## Chosen settings
- Main color: #3df2c6
- Secondary color: #e6b450
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Conectar el sensor"

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

.uvq02-pcb .bx {
  display: block;
  flex: none;
  width: 8.4em;
  height: 4.2em;
  border-radius: .45em;
  filter: drop-shadow(0 .35em .5em rgba(0,0,0,.35));
}

.uvq02-pcb svg {
  display: block;
  width: 100%;
  height: 100%;
}

.uvq02-pcb svg * {
  transform-box: view-box;
}

.uvq02-pcb .bd {
  fill: #0e3b2c;
}

.uvq02-pcb .ho {
  fill: #06231a;
  stroke: var(--c2);
  stroke-width: .7;
}

.uvq02-pcb .tr path,.uvq02-pcb .cu path {
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.uvq02-pcb .tr path {
  stroke: color-mix(in srgb,var(--c2) 80%,#0e3b2c);
}

.uvq02-pcb .cu path {
  stroke: var(--c1);
  stroke-width: 1;
  stroke-dasharray: 1.2 3.4;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .bt {
  fill: #1b1d20;
  stroke: #4a4d52;
  stroke-width: .6;
}

.uvq02-pcb text {
  fill: rgba(255,255,255,.6);
  font: 700 3.2px ui-monospace,Menlo,Consolas,monospace;
}

.uvq02-pcb .bt + text {
  fill: var(--c2);
  font-size: 5px;
}

.uvq02-pcb .pa {
  fill: var(--c2);
}

.uvq02-pcb .lv {
  stroke: #d9dde2;
  stroke-width: 1.8;
  stroke-linecap: round;
  transform-origin: 24px 18px;
  transform: rotate(-34deg);
  transition: transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq02-pcb .le {
  fill: #2a2d30;
  stroke: #5a5f66;
  stroke-width: .7;
  transition: fill calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),filter calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq02-pcb .lh {
  fill: rgba(255,255,255,.35);
}

.uvq02-pcb:hover input:not(:checked) + .bx .lv {
  transform: rotate(-24deg);
}

.uvq02-pcb:active input:not(:checked) + .bx .lv {
  transform: rotate(-10deg);
}

.uvq02-pcb input:checked + .bx .lv {
  transform: none;
}

.uvq02-pcb input:checked + .bx .cu path {
  opacity: 1;
  animation: uvq02-pcb calc(0.7s / var(--k)) linear infinite;
}

.uvq02-pcb input:checked + .bx .le {
  fill: var(--c1);
  filter: drop-shadow(0 0 2.5px var(--c1)) drop-shadow(0 0 6px var(--c1));
}

@keyframes uvq02-pcb {
  to {
    stroke-dashoffset: -4.6;
  }
}

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

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

export default function ChkCircuit() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#3df2c6",
          "--c2": "#e6b450",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <label className="uvq02-pcb"><input type="checkbox" /><span className="bx"><svg viewBox="0 0 72 36" aria-hidden="true"><rect className="bd" width="72" height="36" rx="3.5" /><circle className="ho" cx="4" cy="4" r="1.6" /><circle className="ho" cx="68" cy="4" r="1.6" /><circle className="ho" cx="4" cy="32" r="1.6" /><circle className="ho" cx="68" cy="32" r="1.6" /><g className="tr"><path d="M14 18H24" /><path d="M34 18H44V10H50" /><path d="M58 10H64V29H10V24" /></g><g className="cu"><path d="M14 18H24" /><path d="M34 18H44V10H50" /><path d="M58 10H64V29H10V24" /></g><rect className="bt" x="6" y="12" width="8" height="12" rx="1.2" /><text x="8" y="17">+</text><circle className="pa" cx="24" cy="18" r="2" /><circle className="pa" cx="34" cy="18" r="2" /><line className="lv" x1="24" y1="18" x2="34.5" y2="18" /><circle className="le" cx="54" cy="10" r="4" /><circle className="lh" cx="52.8" cy="8.8" r="1.1" /><text x="25" y="25.5">SW1</text><text x="51.5" y="19">D1</text></svg></span>Connect the sensor</label>
      </div>
    </>
  );
}
```

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