# Camera shutter button

> Six aperture blades close over a blue-coated lens when you press, and the frame counter drops by one.

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

## Where to use it

Built like the top plate of a film camera, this pill has a lens framed by a thin red ring, six CSS aperture blades and a small LCD frame counter. Hovering stops the iris down, pressing closes it completely with a quick flash, and every shot takes one frame off the roll. Great for photo apps, booking a shoot or upload buttons.

The main color tints the lens ring and the secondary color sets the lens coating, so a Leica red or another brand accent is one change away. Keep the label short and verb based, such as Take photo or Scan.

## Code

### HTML

```html
<button class="uvq01-sht" type="button"><span class="ln" aria-hidden="true"><span class="gl"></span><i style="--i:0"></i><i style="--i:1"></i><i style="--i:2"></i><i style="--i:3"></i><i style="--i:4"></i><i style="--i:5"></i></span><span class="t">Take photo</span><span class="ct" aria-hidden="true"><b>36</b></span></button>
```

### CSS

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

.uvq01-sht {
  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;
  gap: .9em;
  padding: .5em 1em .5em .55em;
  border-radius: 999px;
  color: #f3f1ec;
  background: radial-gradient(circle at 1px 1px,rgba(255,255,255,.08) .5px,transparent 1px) 0 0/3px 3px,linear-gradient(180deg,#2b2b2e,#141416);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 0 0 1px #000,0 14px 26px -14px rgba(0,0,0,.7);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-sht .ln {
  position: relative;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  overflow: hidden;
  background: #07070a;
  box-shadow: 0 0 0 .2em #34343a,0 0 0 .27em var(--c1),0 0 0 .33em #0b0b0d;
  --r: 1.05em;
}

.uvq01-sht .gl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%,rgba(255,255,255,.6),transparent 16%),radial-gradient(circle at 62% 66%,color-mix(in srgb,var(--c2) 75%,transparent),transparent 46%),radial-gradient(circle,#1a1e3a 0 30%,#04050b 72%);
}

.uvq01-sht i {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(180deg,transparent 50%,#55555c 50% calc(50% + .05em),#1f1f23 calc(50% + .05em) 60%,#141417);
  filter: brightness(calc(.8 + var(--i) * .06));
  transform: rotate(calc(var(--i) * 60deg)) translateY(var(--r)) rotate(28deg);
  transition: transform calc(0.32s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-sht .ct {
  display: grid;
  place-items: center;
  min-width: 2.1em;
  height: 1.55em;
  padding: 0 .35em;
  border-radius: .3em;
  font: 600 .78em/1 ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  color: #cbe7a2;
  background: #0c1209;
  box-shadow: inset 0 0 0 1px #000,inset 0 1px 4px #000;
}

.uvq01-sht .ct b {
  font-weight: inherit;
}

.uvq01-sht:hover .ln {
  --r: .72em;
}

.uvq01-sht:active .ln,.uvq01-sht.is-snap .ln {
  --r: -.3em;
}

.uvq01-sht:active {
  transform: scale(.97);
}

.uvq01-sht.is-snap .gl {
  animation: uvq01-sht-fl calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-sht.is-snap .ct b {
  animation: uvq01-sht-ct calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

@keyframes uvq01-sht-fl {
  0% {
    filter: brightness(4) saturate(0);
  }
  100% {
    filter: none;
  }
}

@keyframes uvq01-sht-ct {
  0% {
    transform: translateY(-.4em);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq01-sht").forEach(el => {
  const b=el.querySelector(".ct b");let n=36,tm=0;
el.addEventListener("click",()=>{el.classList.remove("is-snap");void el.offsetWidth;el.classList.add("is-snap");n=n>1?n-1:36;b.textContent=String(n).padStart(2,"0");clearTimeout(tm);tm=setTimeout(()=>el.classList.remove("is-snap"),230)});
return()=>clearTimeout(tm)
});
```

### 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-sht {
  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;
  gap: .9em;
  padding: .5em 1em .5em .55em;
  border-radius: 999px;
  color: #f3f1ec;
  background: radial-gradient(circle at 1px 1px,rgba(255,255,255,.08) .5px,transparent 1px) 0 0/3px 3px,linear-gradient(180deg,#2b2b2e,#141416);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 0 0 1px #000,0 14px 26px -14px rgba(0,0,0,.7);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-sht .ln {
  position: relative;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  overflow: hidden;
  background: #07070a;
  box-shadow: 0 0 0 .2em #34343a,0 0 0 .27em var(--c1),0 0 0 .33em #0b0b0d;
  --r: 1.05em;
}

.uvq01-sht .gl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%,rgba(255,255,255,.6),transparent 16%),radial-gradient(circle at 62% 66%,color-mix(in srgb,var(--c2) 75%,transparent),transparent 46%),radial-gradient(circle,#1a1e3a 0 30%,#04050b 72%);
}

.uvq01-sht i {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(180deg,transparent 50%,#55555c 50% calc(50% + .05em),#1f1f23 calc(50% + .05em) 60%,#141417);
  filter: brightness(calc(.8 + var(--i) * .06));
  transform: rotate(calc(var(--i) * 60deg)) translateY(var(--r)) rotate(28deg);
  transition: transform calc(0.32s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-sht .ct {
  display: grid;
  place-items: center;
  min-width: 2.1em;
  height: 1.55em;
  padding: 0 .35em;
  border-radius: .3em;
  font: 600 .78em/1 ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  color: #cbe7a2;
  background: #0c1209;
  box-shadow: inset 0 0 0 1px #000,inset 0 1px 4px #000;
}

.uvq01-sht .ct b {
  font-weight: inherit;
}

.uvq01-sht:hover .ln {
  --r: .72em;
}

.uvq01-sht:active .ln,.uvq01-sht.is-snap .ln {
  --r: -.3em;
}

.uvq01-sht:active {
  transform: scale(.97);
}

.uvq01-sht.is-snap .gl {
  animation: uvq01-sht-fl calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-sht.is-snap .ct b {
  animation: uvq01-sht-ct calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

@keyframes uvq01-sht-fl {
  0% {
    filter: brightness(4) saturate(0);
  }
  100% {
    filter: none;
  }
}

@keyframes uvq01-sht-ct {
  0% {
    transform: translateY(-.4em);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq01-sht,.uvq01-sht *,.uvq01-sht *::before,.uvq01-sht *::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(".ct b");let n=36,tm=0;
el.addEventListener("click",()=>{el.classList.remove("is-snap");void el.offsetWidth;el.classList.add("is-snap");n=n>1?n-1:36;b.textContent=String(n).padStart(2,"0");clearTimeout(tm);tm=setTimeout(()=>el.classList.remove("is-snap"),230)});
return()=>clearTimeout(tm)
}

export default function BtnShutter() {
  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": "#e1251b",
          "--c2": "#4a5bd8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button className="uvq01-sht" type="button"><span className="ln" aria-hidden="true"><span className="gl"></span><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i></span><span className="t">Take photo</span><span className="ct" aria-hidden="true"><b>36</b></span></button>
      </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 “Camera shutter button” block (Buttons) from AIMRAN Library to my project.

## What it is
Six aperture blades close over a blue-coated lens when you press, and the frame counter drops by one.

## Chosen settings
- Main color: #e1251b
- Secondary color: #4a5bd8
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Hacer foto"

## 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-sht {
  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;
  gap: .9em;
  padding: .5em 1em .5em .55em;
  border-radius: 999px;
  color: #f3f1ec;
  background: radial-gradient(circle at 1px 1px,rgba(255,255,255,.08) .5px,transparent 1px) 0 0/3px 3px,linear-gradient(180deg,#2b2b2e,#141416);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14),0 0 0 1px #000,0 14px 26px -14px rgba(0,0,0,.7);
  transition: transform calc(0.3s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-sht .ln {
  position: relative;
  width: 2.8em;
  height: 2.8em;
  border-radius: 50%;
  overflow: hidden;
  background: #07070a;
  box-shadow: 0 0 0 .2em #34343a,0 0 0 .27em var(--c1),0 0 0 .33em #0b0b0d;
  --r: 1.05em;
}

.uvq01-sht .gl {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%,rgba(255,255,255,.6),transparent 16%),radial-gradient(circle at 62% 66%,color-mix(in srgb,var(--c2) 75%,transparent),transparent 46%),radial-gradient(circle,#1a1e3a 0 30%,#04050b 72%);
}

.uvq01-sht i {
  position: absolute;
  left: -50%;
  top: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(180deg,transparent 50%,#55555c 50% calc(50% + .05em),#1f1f23 calc(50% + .05em) 60%,#141417);
  filter: brightness(calc(.8 + var(--i) * .06));
  transform: rotate(calc(var(--i) * 60deg)) translateY(var(--r)) rotate(28deg);
  transition: transform calc(0.32s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-sht .ct {
  display: grid;
  place-items: center;
  min-width: 2.1em;
  height: 1.55em;
  padding: 0 .35em;
  border-radius: .3em;
  font: 600 .78em/1 ui-monospace,"SF Mono",SFMono-Regular,Menlo,Consolas,monospace;
  color: #cbe7a2;
  background: #0c1209;
  box-shadow: inset 0 0 0 1px #000,inset 0 1px 4px #000;
}

.uvq01-sht .ct b {
  font-weight: inherit;
}

.uvq01-sht:hover .ln {
  --r: .72em;
}

.uvq01-sht:active .ln,.uvq01-sht.is-snap .ln {
  --r: -.3em;
}

.uvq01-sht:active {
  transform: scale(.97);
}

.uvq01-sht.is-snap .gl {
  animation: uvq01-sht-fl calc(0.5s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-sht.is-snap .ct b {
  animation: uvq01-sht-ct calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

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

@keyframes uvq01-sht-fl {
  0% {
    filter: brightness(4) saturate(0);
  }
  100% {
    filter: none;
  }
}

@keyframes uvq01-sht-ct {
  0% {
    transform: translateY(-.4em);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq01-sht,.uvq01-sht *,.uvq01-sht *::before,.uvq01-sht *::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(".ct b");let n=36,tm=0;
el.addEventListener("click",()=>{el.classList.remove("is-snap");void el.offsetWidth;el.classList.add("is-snap");n=n>1?n-1:36;b.textContent=String(n).padStart(2,"0");clearTimeout(tm);tm=setTimeout(()=>el.classList.remove("is-snap"),230)});
return()=>clearTimeout(tm)
}

export default function BtnShutter() {
  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": "#e1251b",
          "--c2": "#4a5bd8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button className="uvq01-sht" type="button"><span className="ln" aria-hidden="true"><span className="gl"></span><i style={{ "--i": "0" } as CSSProperties}></i><i style={{ "--i": "1" } as CSSProperties}></i><i style={{ "--i": "2" } as CSSProperties}></i><i style={{ "--i": "3" } as CSSProperties}></i><i style={{ "--i": "4" } as CSSProperties}></i><i style={{ "--i": "5" } as CSSProperties}></i></span><span className="t">Take photo</span><span className="ct" aria-hidden="true"><b>36</b></span></button>
      </div>
    </>
  );
}
```

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