# Rubber stamp approval button

> On approve, a red rubber stamp lands on the invoice with worn ink and the paper jumps a little from the impact.

- Category: [Buttons](https://library.aimran.es/components/buttons)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-btn-rubber-stamp
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Approval flows are often a plain checkbox, and this block gives them weight: a cream invoice card sits above a dark button, and pressing it slams a red APPROVED stamp onto the paper. An SVG noise filter wears the ink like a real rubber stamp, and the card shakes on impact. Pressing again lifts the stamp, with aria-pressed telling assistive tech the current state.

The main color is the ink and the secondary color is the paper, so blue or green stamps for other statuses are a quick change. Swap the invoice lines for your own data, and keep the stamp word short so it fits at an angle.

## Code

### HTML

```html
<div class="uvq01-stp"><div class="doc" aria-hidden="true"><svg class="fx" width="0" height="0"><filter id="uvq01-grit"><feTurbulence type="fractalNoise" baseFrequency="1.2" numOctaves="2" seed="7"/><feColorMatrix values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 1.75"/><feComposite in="SourceGraphic" operator="in"/></filter></svg><span class="h"><b>Invoice</b><span>0187</span></span><span class="ln"></span><span class="ln s"></span><span class="ln m"></span><span class="tt"><span>Amount</span><b>1.240,00 €</b></span><span class="mk">APPROVED</span></div><button class="bt" type="button" aria-pressed="false"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9.5 3.5h5l-.8 6h-3.4z"/><path d="M5 13.5c0-2.2 1.8-4 4-4h6c2.2 0 4 1.8 4 4v1.5H5z"/><path d="M6 19h12"/></svg><span>Approve</span></button></div>
```

### CSS

```css
.uvq01-stp {
  --c1: #c8102e;
  --c2: #f6f0e1;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq01-stp {
  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;
  display: inline-grid;
  justify-items: center;
  gap: 1em;
}

.uvq01-stp .fx {
  position: absolute;
  width: 0;
  height: 0;
}

.uvq01-stp .doc {
  position: relative;
  display: grid;
  gap: .6em;
  width: 13.5em;
  padding: 1.1em 1.2em 1.2em;
  border-radius: .35em;
  font-size: .88em;
  color: #3b3326;
  background: var(--c2);
  box-shadow: 0 1px 0 rgba(0,0,0,.05),0 14px 26px -16px rgba(0,0,0,.45);
}

.uvq01-stp .h,.uvq01-stp .tt {
  display: flex;
  justify-content: space-between;
  gap: 1em;
}

.uvq01-stp .h {
  font-weight: 700;
  letter-spacing: .02em;
}

.uvq01-stp .h span {
  font-family: ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  opacity: .6;
}

.uvq01-stp .ln {
  height: .38em;
  border-radius: 9px;
  background: rgba(59,51,38,.13);
}

.uvq01-stp .s {
  width: 70%;
}

.uvq01-stp .m {
  width: 48%;
}

.uvq01-stp .tt {
  padding-top: .6em;
  border-top: 1px dashed rgba(59,51,38,.32);
}

.uvq01-stp .mk {
  position: absolute;
  right: .5em;
  top: 46%;
  padding: .32em .5em .28em;
  font: 900 1.32em/1 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: .08em;
  color: var(--c1);
  border: .14em solid currentColor;
  border-radius: .25em;
  box-shadow: inset 0 0 0 .1em var(--c2),inset 0 0 0 .2em currentColor;
  mix-blend-mode: multiply;
  filter: url(#uvq01-grit);
  opacity: 0;
  transform: translateY(-50%) rotate(-22deg) scale(1.9);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  pointer-events: none;
}

.uvq01-stp.is-on .mk {
  opacity: .92;
  transform: translateY(-50%) rotate(-12deg) scale(1);
  transition: transform calc(0.26s / var(--k)) cubic-bezier(.55,0,.9,.4),opacity calc(0.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp.is-on .doc {
  animation: uvq01-stp-sh calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.24s / var(--k));
}

.uvq01-stp .bt {
  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;
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.005em;
  white-space: nowrap;
  user-select: none;
  padding: .85em 1.5em;
  border-radius: .7em;
  color: #fff;
  background: #2b2722;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 10px 20px -12px rgba(0,0,0,.6);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp .bt svg {
  width: 1.2em;
  height: 1.2em;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-stp .bt:hover svg {
  transform: translateY(-.15em) rotate(-8deg);
}

.uvq01-stp .bt:active {
  transform: scale(.96);
}

.uvq01-stp .bt:active svg {
  transform: translateY(.12em);
}

.uvq01-stp .bt[aria-pressed="true"] {
  background: var(--c1);
}

.uvq01-stp .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq01-stp-sh {
  0%,100% {
    transform: none;
  }
  30% {
    transform: translateY(.12em) rotate(.4deg);
  }
  60% {
    transform: translateY(-.05em) rotate(-.2deg);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq01-stp").forEach(el => {
  const b=el.querySelector(".bt");b.addEventListener("click",()=>{const on=b.getAttribute("aria-pressed")!=="true";b.setAttribute("aria-pressed",String(on));el.classList.toggle("is-on",on)})
});
```

### React

```tsx
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq01-stp {
  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;
  display: inline-grid;
  justify-items: center;
  gap: 1em;
}

.uvq01-stp .fx {
  position: absolute;
  width: 0;
  height: 0;
}

.uvq01-stp .doc {
  position: relative;
  display: grid;
  gap: .6em;
  width: 13.5em;
  padding: 1.1em 1.2em 1.2em;
  border-radius: .35em;
  font-size: .88em;
  color: #3b3326;
  background: var(--c2);
  box-shadow: 0 1px 0 rgba(0,0,0,.05),0 14px 26px -16px rgba(0,0,0,.45);
}

.uvq01-stp .h,.uvq01-stp .tt {
  display: flex;
  justify-content: space-between;
  gap: 1em;
}

.uvq01-stp .h {
  font-weight: 700;
  letter-spacing: .02em;
}

.uvq01-stp .h span {
  font-family: ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  opacity: .6;
}

.uvq01-stp .ln {
  height: .38em;
  border-radius: 9px;
  background: rgba(59,51,38,.13);
}

.uvq01-stp .s {
  width: 70%;
}

.uvq01-stp .m {
  width: 48%;
}

.uvq01-stp .tt {
  padding-top: .6em;
  border-top: 1px dashed rgba(59,51,38,.32);
}

.uvq01-stp .mk {
  position: absolute;
  right: .5em;
  top: 46%;
  padding: .32em .5em .28em;
  font: 900 1.32em/1 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: .08em;
  color: var(--c1);
  border: .14em solid currentColor;
  border-radius: .25em;
  box-shadow: inset 0 0 0 .1em var(--c2),inset 0 0 0 .2em currentColor;
  mix-blend-mode: multiply;
  filter: url(#uvq01-grit);
  opacity: 0;
  transform: translateY(-50%) rotate(-22deg) scale(1.9);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  pointer-events: none;
}

.uvq01-stp.is-on .mk {
  opacity: .92;
  transform: translateY(-50%) rotate(-12deg) scale(1);
  transition: transform calc(0.26s / var(--k)) cubic-bezier(.55,0,.9,.4),opacity calc(0.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp.is-on .doc {
  animation: uvq01-stp-sh calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.24s / var(--k));
}

.uvq01-stp .bt {
  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;
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.005em;
  white-space: nowrap;
  user-select: none;
  padding: .85em 1.5em;
  border-radius: .7em;
  color: #fff;
  background: #2b2722;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 10px 20px -12px rgba(0,0,0,.6);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp .bt svg {
  width: 1.2em;
  height: 1.2em;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-stp .bt:hover svg {
  transform: translateY(-.15em) rotate(-8deg);
}

.uvq01-stp .bt:active {
  transform: scale(.96);
}

.uvq01-stp .bt:active svg {
  transform: translateY(.12em);
}

.uvq01-stp .bt[aria-pressed="true"] {
  background: var(--c1);
}

.uvq01-stp .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq01-stp-sh {
  0%,100% {
    transform: none;
  }
  30% {
    transform: translateY(.12em) rotate(.4deg);
  }
  60% {
    transform: translateY(-.05em) rotate(-.2deg);
  }
}

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

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const b=el.querySelector(".bt");b.addEventListener("click",()=>{const on=b.getAttribute("aria-pressed")!=="true";b.setAttribute("aria-pressed",String(on));el.classList.toggle("is-on",on)})
}

export default function BtnRubberStamp() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#c8102e",
          "--c2": "#f6f0e1",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq01-stp"><div className="doc" aria-hidden="true"><svg className="fx" width="0" height="0"><filter id="uvq01-grit"><feTurbulence type="fractalNoise" baseFrequency="1.2" numOctaves="2" seed="7" /><feColorMatrix values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 1.75" /><feComposite in="SourceGraphic" operator="in" /></filter></svg><span className="h"><b>Invoice</b><span>0187</span></span><span className="ln"></span><span className="ln s"></span><span className="ln m"></span><span className="tt"><span>Amount</span><b>1.240,00 €</b></span><span className="mk">APPROVED</span></div><button className="bt" type="button" aria-pressed="false"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9.5 3.5h5l-.8 6h-3.4z" /><path d="M5 13.5c0-2.2 1.8-4 4-4h6c2.2 0 4 1.8 4 4v1.5H5z" /><path d="M6 19h12" /></svg><span>Approve</span></button></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 “Rubber stamp approval button” block (Buttons) from AIMRAN Library to my project.

## What it is
On approve, a red rubber stamp lands on the invoice with worn ink and the paper jumps a little from the impact.

## Chosen settings
- Main color: #c8102e
- Secondary color: #f6f0e1
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Aprobar"

## 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
// @ts-nocheck: setup() es JavaScript del DOM sin tipos, el mismo de la pestaña JS.
import { useEffect, useRef, type CSSProperties } from "react";

const css = `
.uvq01-stp {
  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;
  display: inline-grid;
  justify-items: center;
  gap: 1em;
}

.uvq01-stp .fx {
  position: absolute;
  width: 0;
  height: 0;
}

.uvq01-stp .doc {
  position: relative;
  display: grid;
  gap: .6em;
  width: 13.5em;
  padding: 1.1em 1.2em 1.2em;
  border-radius: .35em;
  font-size: .88em;
  color: #3b3326;
  background: var(--c2);
  box-shadow: 0 1px 0 rgba(0,0,0,.05),0 14px 26px -16px rgba(0,0,0,.45);
}

.uvq01-stp .h,.uvq01-stp .tt {
  display: flex;
  justify-content: space-between;
  gap: 1em;
}

.uvq01-stp .h {
  font-weight: 700;
  letter-spacing: .02em;
}

.uvq01-stp .h span {
  font-family: ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  opacity: .6;
}

.uvq01-stp .ln {
  height: .38em;
  border-radius: 9px;
  background: rgba(59,51,38,.13);
}

.uvq01-stp .s {
  width: 70%;
}

.uvq01-stp .m {
  width: 48%;
}

.uvq01-stp .tt {
  padding-top: .6em;
  border-top: 1px dashed rgba(59,51,38,.32);
}

.uvq01-stp .mk {
  position: absolute;
  right: .5em;
  top: 46%;
  padding: .32em .5em .28em;
  font: 900 1.32em/1 "Arial Black","Helvetica Neue",Arial,sans-serif;
  letter-spacing: .08em;
  color: var(--c1);
  border: .14em solid currentColor;
  border-radius: .25em;
  box-shadow: inset 0 0 0 .1em var(--c2),inset 0 0 0 .2em currentColor;
  mix-blend-mode: multiply;
  filter: url(#uvq01-grit);
  opacity: 0;
  transform: translateY(-50%) rotate(-22deg) scale(1.9);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
  pointer-events: none;
}

.uvq01-stp.is-on .mk {
  opacity: .92;
  transform: translateY(-50%) rotate(-12deg) scale(1);
  transition: transform calc(0.26s / var(--k)) cubic-bezier(.55,0,.9,.4),opacity calc(0.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp.is-on .doc {
  animation: uvq01-stp-sh calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1) calc(0.24s / var(--k));
}

.uvq01-stp .bt {
  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;
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .6em;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.005em;
  white-space: nowrap;
  user-select: none;
  padding: .85em 1.5em;
  border-radius: .7em;
  color: #fff;
  background: #2b2722;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12),0 10px 20px -12px rgba(0,0,0,.6);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-stp .bt svg {
  width: 1.2em;
  height: 1.2em;
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-stp .bt:hover svg {
  transform: translateY(-.15em) rotate(-8deg);
}

.uvq01-stp .bt:active {
  transform: scale(.96);
}

.uvq01-stp .bt:active svg {
  transform: translateY(.12em);
}

.uvq01-stp .bt[aria-pressed="true"] {
  background: var(--c1);
}

.uvq01-stp .bt:focus-visible {
  outline: 2px solid var(--c1);
  outline-offset: 3px;
}

@keyframes uvq01-stp-sh {
  0%,100% {
    transform: none;
  }
  30% {
    transform: translateY(.12em) rotate(.4deg);
  }
  60% {
    transform: translateY(-.05em) rotate(-.2deg);
  }
}

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

// Interacción en JavaScript del DOM: la misma que en la pestaña JS.
// eslint-disable-next-line @typescript-eslint/no-explicit-any
function setup(el: any) {
  const b=el.querySelector(".bt");b.addEventListener("click",()=>{const on=b.getAttribute("aria-pressed")!=="true";b.setAttribute("aria-pressed",String(on));el.classList.toggle("is-on",on)})
}

export default function BtnRubberStamp() {
  const ref = useRef<HTMLDivElement>(null);

  useEffect(() => {
    const el = ref.current?.firstElementChild;
    return el ? setup(el) : undefined;
  }, []);

  return (
    <>
      <style>{css}</style>
      <div
        ref={ref} style={{
          "--c1": "#c8102e",
          "--c2": "#f6f0e1",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq01-stp"><div className="doc" aria-hidden="true"><svg className="fx" width="0" height="0"><filter id="uvq01-grit"><feTurbulence type="fractalNoise" baseFrequency="1.2" numOctaves="2" seed="7" /><feColorMatrix values="0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 -2.4 1.75" /><feComposite in="SourceGraphic" operator="in" /></filter></svg><span className="h"><b>Invoice</b><span>0187</span></span><span className="ln"></span><span className="ln s"></span><span className="ln m"></span><span className="tt"><span>Amount</span><b>1.240,00 €</b></span><span className="mk">APPROVED</span></div><button className="bt" type="button" aria-pressed="false"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9.5 3.5h5l-.8 6h-3.4z" /><path d="M5 13.5c0-2.2 1.8-4 4-4h6c2.2 0 4 1.8 4 4v1.5H5z" /><path d="M6 19h12" /></svg><span>Approve</span></button></div>
      </div>
    </>
  );
}
```

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