# Thermal receipt printer loader

> A receipt feeds out of the slot in short jerks, pauses and is torn off to make room for the next one.

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

## Where to use it

This loader draws a small thermal printer in CSS and pushes a paper receipt out of its slot with stepped motion, so it feels like a real print head at work. The ticket has lines, a total and a barcode, then tears away. It fits checkouts, order confirmations and point of sale screens.

Change the main color to restyle the printer body and the second color for the status light. Keep it next to a short message such as the order number, and slow it down when the wait is long.

## Code

### HTML

```html
<div class="uvq10-tkt" role="status"><span class="sr">Printing receipt</span><div class="pr" aria-hidden="true"><i class="led"></i><i class="sl"></i></div><div class="win" aria-hidden="true"><div class="pp"><i class="hd"></i><b style="--w:52%"></b><b style="--w:68%"></b><b style="--w:44%"></b><b style="--w:60%"></b><i class="hr"></i><b class="tt" style="--w:38%"></b><i class="bc"></i></div></div></div>
```

### CSS

```css
.uvq10-tkt {
  --c1: #2b2d31;
  --c2: #34d399;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq10-tkt {
  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: flex;
  flex-direction: column;
  align-items: center;
  width: 9em;
}

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

.uvq10-tkt .pr {
  position: relative;
  z-index: 2;
  width: 9em;
  height: 2.6em;
  border-radius: .9em .9em .5em .5em;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 70%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 82%,#000));
  box-shadow: 0 .6em 1em -.5em rgba(0,0,0,.5),inset 0 1px 0 rgba(255,255,255,.25),0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq10-tkt .led {
  position: absolute;
  right: .9em;
  top: .75em;
  width: .38em;
  height: .38em;
  border-radius: 50%;
  background: var(--c2);
  box-shadow: 0 0 .5em var(--c2);
  animation: uvq10-tkt-l calc(0.4s / var(--k)) steps(1) infinite;
}

.uvq10-tkt .sl {
  position: absolute;
  left: 1.1em;
  right: 1.1em;
  bottom: .45em;
  height: .3em;
  border-radius: .2em;
  background: #0b0b0d;
  box-shadow: inset 0 .1em .15em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.12);
}

.uvq10-tkt .win {
  position: relative;
  width: 6.6em;
  height: 7.4em;
  margin-top: -.75em;
  overflow: hidden;
}

.uvq10-tkt .pp {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: .36em;
  width: 6em;
  height: 6.6em;
  margin: 0 auto;
  padding: 1em .6em .9em;
  background: #fbfaf5;
  color: #2b2b2b;
  clip-path: polygon(0 0,100% 0,100% calc(100% - .35em),93.75% 100%,87.5% calc(100% - .35em),81.25% 100%,75% calc(100% - .35em),68.75% 100%,62.5% calc(100% - .35em),56.25% 100%,50% calc(100% - .35em),43.75% 100%,37.5% calc(100% - .35em),31.25% 100%,25% calc(100% - .35em),18.75% 100%,12.5% calc(100% - .35em),6.25% 100%,0% calc(100% - .35em));
  transform-origin: 50% 0;
  transform: translateY(-100%);
  animation: uvq10-tkt calc(3.4s / var(--k)) infinite;
}

.uvq10-tkt .pp>* {
  display: block;
  flex: none;
}

.uvq10-tkt .hd {
  width: 46%;
  height: .42em;
  margin: 0 auto .15em;
  border-radius: .1em;
  background: currentColor;
}

.uvq10-tkt b {
  height: .2em;
  background: linear-gradient(90deg,currentColor 0 var(--w),transparent 0 78%,currentColor 0);
  opacity: .7;
}

.uvq10-tkt .hr {
  height: 0;
  border-top: .12em dashed currentColor;
  opacity: .45;
}

.uvq10-tkt b.tt {
  height: .32em;
  opacity: 1;
}

.uvq10-tkt .bc {
  height: .95em;
  margin-top: auto;
  background: repeating-linear-gradient(90deg,currentColor 0 .08em,transparent 0 .16em,currentColor 0 .2em,transparent 0 .32em,currentColor 0 .46em,transparent 0 .54em);
}

@keyframes uvq10-tkt {
  0% {
    transform: translateY(-100%);
    opacity: 1;
    animation-timing-function: steps(14,end);
  }
  60% {
    transform: translateY(0);
    opacity: 1;
    animation-timing-function: ease-out;
  }
  72% {
    transform: translateY(0) rotate(0);
  }
  76% {
    transform: translateY(.25em) rotate(-3deg);
    animation-timing-function: ease-in;
  }
  92%,100% {
    transform: translateY(2.6em) rotate(7deg);
    opacity: 0;
  }
}

@keyframes uvq10-tkt-l {
  50% {
    opacity: .25;
  }
}

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

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    animation: none!important;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    transform: none;
  }
}
```

### React

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

const css = `
.uvq10-tkt {
  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: flex;
  flex-direction: column;
  align-items: center;
  width: 9em;
}

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

.uvq10-tkt .pr {
  position: relative;
  z-index: 2;
  width: 9em;
  height: 2.6em;
  border-radius: .9em .9em .5em .5em;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 70%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 82%,#000));
  box-shadow: 0 .6em 1em -.5em rgba(0,0,0,.5),inset 0 1px 0 rgba(255,255,255,.25),0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq10-tkt .led {
  position: absolute;
  right: .9em;
  top: .75em;
  width: .38em;
  height: .38em;
  border-radius: 50%;
  background: var(--c2);
  box-shadow: 0 0 .5em var(--c2);
  animation: uvq10-tkt-l calc(0.4s / var(--k)) steps(1) infinite;
}

.uvq10-tkt .sl {
  position: absolute;
  left: 1.1em;
  right: 1.1em;
  bottom: .45em;
  height: .3em;
  border-radius: .2em;
  background: #0b0b0d;
  box-shadow: inset 0 .1em .15em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.12);
}

.uvq10-tkt .win {
  position: relative;
  width: 6.6em;
  height: 7.4em;
  margin-top: -.75em;
  overflow: hidden;
}

.uvq10-tkt .pp {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: .36em;
  width: 6em;
  height: 6.6em;
  margin: 0 auto;
  padding: 1em .6em .9em;
  background: #fbfaf5;
  color: #2b2b2b;
  clip-path: polygon(0 0,100% 0,100% calc(100% - .35em),93.75% 100%,87.5% calc(100% - .35em),81.25% 100%,75% calc(100% - .35em),68.75% 100%,62.5% calc(100% - .35em),56.25% 100%,50% calc(100% - .35em),43.75% 100%,37.5% calc(100% - .35em),31.25% 100%,25% calc(100% - .35em),18.75% 100%,12.5% calc(100% - .35em),6.25% 100%,0% calc(100% - .35em));
  transform-origin: 50% 0;
  transform: translateY(-100%);
  animation: uvq10-tkt calc(3.4s / var(--k)) infinite;
}

.uvq10-tkt .pp>* {
  display: block;
  flex: none;
}

.uvq10-tkt .hd {
  width: 46%;
  height: .42em;
  margin: 0 auto .15em;
  border-radius: .1em;
  background: currentColor;
}

.uvq10-tkt b {
  height: .2em;
  background: linear-gradient(90deg,currentColor 0 var(--w),transparent 0 78%,currentColor 0);
  opacity: .7;
}

.uvq10-tkt .hr {
  height: 0;
  border-top: .12em dashed currentColor;
  opacity: .45;
}

.uvq10-tkt b.tt {
  height: .32em;
  opacity: 1;
}

.uvq10-tkt .bc {
  height: .95em;
  margin-top: auto;
  background: repeating-linear-gradient(90deg,currentColor 0 .08em,transparent 0 .16em,currentColor 0 .2em,transparent 0 .32em,currentColor 0 .46em,transparent 0 .54em);
}

@keyframes uvq10-tkt {
  0% {
    transform: translateY(-100%);
    opacity: 1;
    animation-timing-function: steps(14,end);
  }
  60% {
    transform: translateY(0);
    opacity: 1;
    animation-timing-function: ease-out;
  }
  72% {
    transform: translateY(0) rotate(0);
  }
  76% {
    transform: translateY(.25em) rotate(-3deg);
    animation-timing-function: ease-in;
  }
  92%,100% {
    transform: translateY(2.6em) rotate(7deg);
    opacity: 0;
  }
}

@keyframes uvq10-tkt-l {
  50% {
    opacity: .25;
  }
}

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

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    animation: none!important;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    transform: none;
  }
}
`;

export default function LdThermalTicket() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#2b2d31",
          "--c2": "#34d399",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-tkt" role="status"><span className="sr">Printing receipt</span><div className="pr" aria-hidden="true"><i className="led"></i><i className="sl"></i></div><div className="win" aria-hidden="true"><div className="pp"><i className="hd"></i><b style={{ "--w": "52%" } as CSSProperties}></b><b style={{ "--w": "68%" } as CSSProperties}></b><b style={{ "--w": "44%" } as CSSProperties}></b><b style={{ "--w": "60%" } as CSSProperties}></b><i className="hr"></i><b className="tt" style={{ "--w": "38%" } as CSSProperties}></b><i className="bc"></i></div></div></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 “Thermal receipt printer loader” block (Loaders) from AIMRAN Library to my project.

## What it is
A receipt feeds out of the slot in short jerks, pauses and is torn off to make room for the next one.

## Chosen settings
- Main color: #2b2d31
- Secondary color: #34d399
- 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-tkt {
  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: flex;
  flex-direction: column;
  align-items: center;
  width: 9em;
}

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

.uvq10-tkt .pr {
  position: relative;
  z-index: 2;
  width: 9em;
  height: 2.6em;
  border-radius: .9em .9em .5em .5em;
  background: linear-gradient(180deg,color-mix(in srgb,var(--c1) 70%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 82%,#000));
  box-shadow: 0 .6em 1em -.5em rgba(0,0,0,.5),inset 0 1px 0 rgba(255,255,255,.25),0 0 0 1px color-mix(in srgb,var(--fg) 10%,transparent);
}

.uvq10-tkt .led {
  position: absolute;
  right: .9em;
  top: .75em;
  width: .38em;
  height: .38em;
  border-radius: 50%;
  background: var(--c2);
  box-shadow: 0 0 .5em var(--c2);
  animation: uvq10-tkt-l calc(0.4s / var(--k)) steps(1) infinite;
}

.uvq10-tkt .sl {
  position: absolute;
  left: 1.1em;
  right: 1.1em;
  bottom: .45em;
  height: .3em;
  border-radius: .2em;
  background: #0b0b0d;
  box-shadow: inset 0 .1em .15em rgba(0,0,0,.8),0 1px 0 rgba(255,255,255,.12);
}

.uvq10-tkt .win {
  position: relative;
  width: 6.6em;
  height: 7.4em;
  margin-top: -.75em;
  overflow: hidden;
}

.uvq10-tkt .pp {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: .36em;
  width: 6em;
  height: 6.6em;
  margin: 0 auto;
  padding: 1em .6em .9em;
  background: #fbfaf5;
  color: #2b2b2b;
  clip-path: polygon(0 0,100% 0,100% calc(100% - .35em),93.75% 100%,87.5% calc(100% - .35em),81.25% 100%,75% calc(100% - .35em),68.75% 100%,62.5% calc(100% - .35em),56.25% 100%,50% calc(100% - .35em),43.75% 100%,37.5% calc(100% - .35em),31.25% 100%,25% calc(100% - .35em),18.75% 100%,12.5% calc(100% - .35em),6.25% 100%,0% calc(100% - .35em));
  transform-origin: 50% 0;
  transform: translateY(-100%);
  animation: uvq10-tkt calc(3.4s / var(--k)) infinite;
}

.uvq10-tkt .pp>* {
  display: block;
  flex: none;
}

.uvq10-tkt .hd {
  width: 46%;
  height: .42em;
  margin: 0 auto .15em;
  border-radius: .1em;
  background: currentColor;
}

.uvq10-tkt b {
  height: .2em;
  background: linear-gradient(90deg,currentColor 0 var(--w),transparent 0 78%,currentColor 0);
  opacity: .7;
}

.uvq10-tkt .hr {
  height: 0;
  border-top: .12em dashed currentColor;
  opacity: .45;
}

.uvq10-tkt b.tt {
  height: .32em;
  opacity: 1;
}

.uvq10-tkt .bc {
  height: .95em;
  margin-top: auto;
  background: repeating-linear-gradient(90deg,currentColor 0 .08em,transparent 0 .16em,currentColor 0 .2em,transparent 0 .32em,currentColor 0 .46em,transparent 0 .54em);
}

@keyframes uvq10-tkt {
  0% {
    transform: translateY(-100%);
    opacity: 1;
    animation-timing-function: steps(14,end);
  }
  60% {
    transform: translateY(0);
    opacity: 1;
    animation-timing-function: ease-out;
  }
  72% {
    transform: translateY(0) rotate(0);
  }
  76% {
    transform: translateY(.25em) rotate(-3deg);
    animation-timing-function: ease-in;
  }
  92%,100% {
    transform: translateY(2.6em) rotate(7deg);
    opacity: 0;
  }
}

@keyframes uvq10-tkt-l {
  50% {
    opacity: .25;
  }
}

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

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    animation: none!important;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq10-tkt .pp {
    transform: none;
  }
}
`;

export default function LdThermalTicket() {
  return (
    <>
      <style>{css}</style>
      <div
        style={{
          "--c1": "#2b2d31",
          "--c2": "#34d399",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq10-tkt" role="status"><span className="sr">Printing receipt</span><div className="pr" aria-hidden="true"><i className="led"></i><i className="sl"></i></div><div className="win" aria-hidden="true"><div className="pp"><i className="hd"></i><b style={{ "--w": "52%" } as CSSProperties}></b><b style={{ "--w": "68%" } as CSSProperties}></b><b style={{ "--w": "44%" } as CSSProperties}></b><b style={{ "--w": "60%" } as CSSProperties}></b><i className="hr"></i><b className="tt" style={{ "--w": "38%" } as CSSProperties}></b><i className="bc"></i></div></div></div>
      </div>
    </>
  );
}
```

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