# Barcode scanner loader

> A red laser sweeps over a barcode label inside a cornered viewfinder, like at a supermarket checkout.

- Category: [Loaders](https://library.aimran.es/components/loaders)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-ld-barcode-scan
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

A white label with a barcode generated as inline SVG and its digits, framed by four viewfinder corners. A red laser line with a soft glow band moves up and down across it with easing at each end. It suits retail apps, inventory tools, ticket validation, delivery tracking and any screen that reads a code.

The main color sets the laser and the second the viewfinder corners, so you can match a scanning green or a brand tone. Show it while a code is checked, then swap it for a clear success state.

## Code

### HTML

```html
<div class="uvq10-bar" role="status"><span class="sr">Scanning</span><div class="lb" aria-hidden="true"><svg viewBox="0 0 87 46" preserveAspectRatio="none"><rect x="0" width="1" height="46"/><rect x="2" width="1" height="46"/><rect x="5" width="1" height="40"/><rect x="8" width="1" height="40"/><rect x="10" width="3" height="40"/><rect x="14" width="2" height="40"/><rect x="18" width="3" height="40"/><rect x="23" width="1" height="40"/><rect x="25" width="2" height="40"/><rect x="28" width="1" height="40"/><rect x="30" width="1" height="40"/><rect x="33" width="1" height="40"/><rect x="35" width="2" height="40"/><rect x="39" width="1" height="40"/><rect x="42" width="1" height="46"/><rect x="44" width="1" height="46"/><rect x="47" width="1" height="40"/><rect x="49" width="3" height="40"/><rect x="53" width="2" height="40"/><rect x="56" width="1" height="40"/><rect x="59" width="2" height="40"/><rect x="63" width="2" height="40"/><rect x="67" width="2" height="40"/><rect x="70" width="1" height="40"/><rect x="72" width="3" height="40"/><rect x="76" width="1" height="40"/><rect x="78" width="1" height="40"/><rect x="80" width="1" height="40"/><rect x="84" width="1" height="46"/><rect x="86" width="1" height="46"/></svg><span class="dg">8 412345 678905</span><i class="ls"></i></div><i class="cn tl" aria-hidden="true"></i><i class="cn tr" aria-hidden="true"></i><i class="cn bl" aria-hidden="true"></i><i class="cn br" aria-hidden="true"></i></div>
```

### CSS

```css
.uvq10-bar {
  --c1: #ff2d2d;
  --c2: #9ca3af;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq10-bar {
  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;
  padding: 1.1em 1.2em;
}

.uvq10-bar .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-bar .lb {
  position: relative;
  width: 10em;
  padding: .7em .8em .5em;
  border-radius: .3em;
  background: #fff;
  box-shadow: 0 .5em 1em -.5em rgba(0,0,0,.4),0 0 0 1px rgba(0,0,0,.06);
}

.uvq10-bar svg {
  display: block;
  width: 100%;
  height: 3.4em;
  fill: #111;
}

.uvq10-bar .dg {
  display: block;
  margin-top: .25em;
  text-align: center;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .14em;
  color: #111;
}

.uvq10-bar .ls {
  position: absolute;
  left: -.5em;
  right: -.5em;
  top: 12%;
  height: 2px;
  border-radius: 2px;
  background: var(--c1);
  box-shadow: 0 0 .35em var(--c1),0 0 1em .1em color-mix(in srgb,var(--c1) 60%,transparent);
  animation: uvq10-bar calc(1.5s / var(--k)) ease-in-out infinite alternate;
}

.uvq10-bar .ls::before {
  content: "";
  position: absolute;
  left: .5em;
  right: .5em;
  top: -.9em;
  height: 1.8em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--c1) 18%,transparent),transparent);
}

.uvq10-bar .cn {
  position: absolute;
  width: 1em;
  height: 1em;
  border: .18em solid var(--c2);
}

.uvq10-bar .tl {
  left: 0;
  top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: .35em 0 0 0;
}

.uvq10-bar .tr {
  right: 0;
  top: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 .35em 0 0;
}

.uvq10-bar .bl {
  left: 0;
  bottom: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 .35em;
}

.uvq10-bar .br {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 .35em 0;
}

@keyframes uvq10-bar {
  from {
    top: 10%;
  }
  to {
    top: 86%;
  }
}

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

### React

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

const css = `
.uvq10-bar {
  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;
  padding: 1.1em 1.2em;
}

.uvq10-bar .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-bar .lb {
  position: relative;
  width: 10em;
  padding: .7em .8em .5em;
  border-radius: .3em;
  background: #fff;
  box-shadow: 0 .5em 1em -.5em rgba(0,0,0,.4),0 0 0 1px rgba(0,0,0,.06);
}

.uvq10-bar svg {
  display: block;
  width: 100%;
  height: 3.4em;
  fill: #111;
}

.uvq10-bar .dg {
  display: block;
  margin-top: .25em;
  text-align: center;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .14em;
  color: #111;
}

.uvq10-bar .ls {
  position: absolute;
  left: -.5em;
  right: -.5em;
  top: 12%;
  height: 2px;
  border-radius: 2px;
  background: var(--c1);
  box-shadow: 0 0 .35em var(--c1),0 0 1em .1em color-mix(in srgb,var(--c1) 60%,transparent);
  animation: uvq10-bar calc(1.5s / var(--k)) ease-in-out infinite alternate;
}

.uvq10-bar .ls::before {
  content: "";
  position: absolute;
  left: .5em;
  right: .5em;
  top: -.9em;
  height: 1.8em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--c1) 18%,transparent),transparent);
}

.uvq10-bar .cn {
  position: absolute;
  width: 1em;
  height: 1em;
  border: .18em solid var(--c2);
}

.uvq10-bar .tl {
  left: 0;
  top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: .35em 0 0 0;
}

.uvq10-bar .tr {
  right: 0;
  top: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 .35em 0 0;
}

.uvq10-bar .bl {
  left: 0;
  bottom: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 .35em;
}

.uvq10-bar .br {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 .35em 0;
}

@keyframes uvq10-bar {
  from {
    top: 10%;
  }
  to {
    top: 86%;
  }
}

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

export default function LdBarcodeScan() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff2d2d",
          "--c2": "#9ca3af",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-bar" role="status"><span className="sr">Scanning</span><div className="lb" aria-hidden="true"><svg viewBox="0 0 87 46" preserveAspectRatio="none"><rect x="0" width="1" height="46" /><rect x="2" width="1" height="46" /><rect x="5" width="1" height="40" /><rect x="8" width="1" height="40" /><rect x="10" width="3" height="40" /><rect x="14" width="2" height="40" /><rect x="18" width="3" height="40" /><rect x="23" width="1" height="40" /><rect x="25" width="2" height="40" /><rect x="28" width="1" height="40" /><rect x="30" width="1" height="40" /><rect x="33" width="1" height="40" /><rect x="35" width="2" height="40" /><rect x="39" width="1" height="40" /><rect x="42" width="1" height="46" /><rect x="44" width="1" height="46" /><rect x="47" width="1" height="40" /><rect x="49" width="3" height="40" /><rect x="53" width="2" height="40" /><rect x="56" width="1" height="40" /><rect x="59" width="2" height="40" /><rect x="63" width="2" height="40" /><rect x="67" width="2" height="40" /><rect x="70" width="1" height="40" /><rect x="72" width="3" height="40" /><rect x="76" width="1" height="40" /><rect x="78" width="1" height="40" /><rect x="80" width="1" height="40" /><rect x="84" width="1" height="46" /><rect x="86" width="1" height="46" /></svg><span className="dg">8 412345 678905</span><i className="ls"></i></div><i className="cn tl" aria-hidden="true"></i><i className="cn tr" aria-hidden="true"></i><i className="cn bl" aria-hidden="true"></i><i className="cn br" aria-hidden="true"></i></div>
      </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 “Barcode scanner loader” block (Loaders) from AIMRAN Library to my project.

## What it is
A red laser sweeps over a barcode label inside a cornered viewfinder, like at a supermarket checkout.

## Chosen settings
- Main color: #ff2d2d
- Secondary color: #9ca3af
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)

## 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 = `
.uvq10-bar {
  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;
  padding: 1.1em 1.2em;
}

.uvq10-bar .sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.uvq10-bar .lb {
  position: relative;
  width: 10em;
  padding: .7em .8em .5em;
  border-radius: .3em;
  background: #fff;
  box-shadow: 0 .5em 1em -.5em rgba(0,0,0,.4),0 0 0 1px rgba(0,0,0,.06);
}

.uvq10-bar svg {
  display: block;
  width: 100%;
  height: 3.4em;
  fill: #111;
}

.uvq10-bar .dg {
  display: block;
  margin-top: .25em;
  text-align: center;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .14em;
  color: #111;
}

.uvq10-bar .ls {
  position: absolute;
  left: -.5em;
  right: -.5em;
  top: 12%;
  height: 2px;
  border-radius: 2px;
  background: var(--c1);
  box-shadow: 0 0 .35em var(--c1),0 0 1em .1em color-mix(in srgb,var(--c1) 60%,transparent);
  animation: uvq10-bar calc(1.5s / var(--k)) ease-in-out infinite alternate;
}

.uvq10-bar .ls::before {
  content: "";
  position: absolute;
  left: .5em;
  right: .5em;
  top: -.9em;
  height: 1.8em;
  background: linear-gradient(transparent,color-mix(in srgb,var(--c1) 18%,transparent),transparent);
}

.uvq10-bar .cn {
  position: absolute;
  width: 1em;
  height: 1em;
  border: .18em solid var(--c2);
}

.uvq10-bar .tl {
  left: 0;
  top: 0;
  border-right: 0;
  border-bottom: 0;
  border-radius: .35em 0 0 0;
}

.uvq10-bar .tr {
  right: 0;
  top: 0;
  border-left: 0;
  border-bottom: 0;
  border-radius: 0 .35em 0 0;
}

.uvq10-bar .bl {
  left: 0;
  bottom: 0;
  border-right: 0;
  border-top: 0;
  border-radius: 0 0 0 .35em;
}

.uvq10-bar .br {
  right: 0;
  bottom: 0;
  border-left: 0;
  border-top: 0;
  border-radius: 0 0 .35em 0;
}

@keyframes uvq10-bar {
  from {
    top: 10%;
  }
  to {
    top: 86%;
  }
}

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

export default function LdBarcodeScan() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#ff2d2d",
          "--c2": "#9ca3af",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-bar" role="status"><span className="sr">Scanning</span><div className="lb" aria-hidden="true"><svg viewBox="0 0 87 46" preserveAspectRatio="none"><rect x="0" width="1" height="46" /><rect x="2" width="1" height="46" /><rect x="5" width="1" height="40" /><rect x="8" width="1" height="40" /><rect x="10" width="3" height="40" /><rect x="14" width="2" height="40" /><rect x="18" width="3" height="40" /><rect x="23" width="1" height="40" /><rect x="25" width="2" height="40" /><rect x="28" width="1" height="40" /><rect x="30" width="1" height="40" /><rect x="33" width="1" height="40" /><rect x="35" width="2" height="40" /><rect x="39" width="1" height="40" /><rect x="42" width="1" height="46" /><rect x="44" width="1" height="46" /><rect x="47" width="1" height="40" /><rect x="49" width="3" height="40" /><rect x="53" width="2" height="40" /><rect x="56" width="1" height="40" /><rect x="59" width="2" height="40" /><rect x="63" width="2" height="40" /><rect x="67" width="2" height="40" /><rect x="70" width="1" height="40" /><rect x="72" width="3" height="40" /><rect x="76" width="1" height="40" /><rect x="78" width="1" height="40" /><rect x="80" width="1" height="40" /><rect x="84" width="1" height="46" /><rect x="86" width="1" height="46" /></svg><span className="dg">8 412345 678905</span><i className="ls"></i></div><i className="cn tl" aria-hidden="true"></i><i className="cn tr" aria-hidden="true"></i><i className="cn bl" aria-hidden="true"></i><i className="cn br" aria-hidden="true"></i></div>
      </div>
    </>
  );
}
```

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