# Climbing carabiner button

> The carabiner gate swings open on hover; on press the locking sleeve slides up, the rope gets a tug and it is secured.

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

## Where to use it

A toggle taken from a climbing harness: an anodized orange carabiner with a rope running through it sits next to the label. Hovering pushes the spring gate inwards, and pressing slides the locking sleeve over the nose, tugs the rope and swaps the label to its secured state. While locked, the gate only twitches when you hover. It suits climbing gyms, outdoor shops and safety settings.

The main color is the anodized aluminium and the secondary color is the rope, so a blue carabiner with a red rope is a quick change. The state is exposed with aria-pressed, and reduced motion keeps every change instant.

## Code

### HTML

```html
<button class="uvq01-crb" type="button" aria-label="Secure" aria-pressed="false"><svg viewBox="0 0 40 60" aria-hidden="true"><g class="rpg"><path class="rp" d="M-2 57C8 45 32 45 42 57"/><path class="rp2" d="M-2 57C8 45 32 45 42 57"/></g><path class="bd" d="M6 16a10 10 0 0 1 10-10h8a10 10 0 0 1 10 10v28a10 10 0 0 1-10 10h-8a10 10 0 0 1-10-10"/><g class="gt"><path d="M6 18v25"/><rect class="sl" x="3" y="33" width="6" height="9" rx="1.8"/></g></svg><span class="w" aria-hidden="true"><span class="a">Secure</span><span class="b">Secured</span></span></button>
```

### CSS

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

.uvq01-crb {
  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: .8em;
  padding: .45em 1.6em .45em .95em;
  border-radius: 999px;
  color: #f1f3f5;
  background: linear-gradient(180deg,#2c3137,#1b1f24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1),0 0 0 1px #0d0f12,0 12px 24px -12px rgba(0,0,0,.6);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb svg {
  width: 2.1em;
  height: 3.15em;
  overflow: visible;
}

.uvq01-crb .bd {
  fill: none;
  stroke: var(--c1);
  stroke-width: 4.4;
  stroke-linecap: round;
}

.uvq01-crb .gt path {
  fill: none;
  stroke: #c9ced6;
  stroke-width: 3;
  stroke-linecap: round;
}

.uvq01-crb .gt {
  transform-origin: 6px 43px;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb .sl {
  fill: #8b939e;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),fill calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb .rp {
  fill: none;
  stroke: var(--c2);
  stroke-width: 5.5;
  stroke-linecap: round;
}

.uvq01-crb .rp2 {
  fill: none;
  stroke: rgba(255,255,255,.45);
  stroke-width: 5.5;
  stroke-dasharray: 1.6 2.6;
}

.uvq01-crb .w {
  display: grid;
}

.uvq01-crb .a,.uvq01-crb .b {
  grid-area: 1/1;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),translate calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-crb .b {
  opacity: 0;
  translate: 0 .5em;
}

.uvq01-crb:hover .gt,.uvq01-crb:focus-visible .gt {
  transform: rotate(24deg);
}

.uvq01-crb[aria-pressed="true"] {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 45%,#1b1f24),#1b1f24);
}

.uvq01-crb[aria-pressed="true"] .gt {
  transform: none;
}

.uvq01-crb[aria-pressed="true"]:hover .gt {
  animation: uvq01-crb-try calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb[aria-pressed="true"] .sl {
  transform: translateY(-15px);
  fill: var(--c1);
}

.uvq01-crb[aria-pressed="true"] .rpg {
  animation: uvq01-crb-tug calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb[aria-pressed="true"] .a {
  opacity: 0;
  translate: 0 -.5em;
}

.uvq01-crb[aria-pressed="true"] .b {
  opacity: 1;
  translate: 0 0;
}

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

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

@keyframes uvq01-crb-try {
  0%,100% {
    transform: none;
  }
  40% {
    transform: rotate(5deg);
  }
  70% {
    transform: rotate(-1deg);
  }
}

@keyframes uvq01-crb-tug {
  0%,100% {
    transform: none;
  }
  40% {
    transform: translateY(-4px);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq01-crb").forEach(el => {
  el.addEventListener("click",()=>el.setAttribute("aria-pressed",el.getAttribute("aria-pressed")==="true"?"false":"true"))
});
```

### 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-crb {
  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: .8em;
  padding: .45em 1.6em .45em .95em;
  border-radius: 999px;
  color: #f1f3f5;
  background: linear-gradient(180deg,#2c3137,#1b1f24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1),0 0 0 1px #0d0f12,0 12px 24px -12px rgba(0,0,0,.6);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb svg {
  width: 2.1em;
  height: 3.15em;
  overflow: visible;
}

.uvq01-crb .bd {
  fill: none;
  stroke: var(--c1);
  stroke-width: 4.4;
  stroke-linecap: round;
}

.uvq01-crb .gt path {
  fill: none;
  stroke: #c9ced6;
  stroke-width: 3;
  stroke-linecap: round;
}

.uvq01-crb .gt {
  transform-origin: 6px 43px;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb .sl {
  fill: #8b939e;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),fill calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb .rp {
  fill: none;
  stroke: var(--c2);
  stroke-width: 5.5;
  stroke-linecap: round;
}

.uvq01-crb .rp2 {
  fill: none;
  stroke: rgba(255,255,255,.45);
  stroke-width: 5.5;
  stroke-dasharray: 1.6 2.6;
}

.uvq01-crb .w {
  display: grid;
}

.uvq01-crb .a,.uvq01-crb .b {
  grid-area: 1/1;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),translate calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-crb .b {
  opacity: 0;
  translate: 0 .5em;
}

.uvq01-crb:hover .gt,.uvq01-crb:focus-visible .gt {
  transform: rotate(24deg);
}

.uvq01-crb[aria-pressed="true"] {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 45%,#1b1f24),#1b1f24);
}

.uvq01-crb[aria-pressed="true"] .gt {
  transform: none;
}

.uvq01-crb[aria-pressed="true"]:hover .gt {
  animation: uvq01-crb-try calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb[aria-pressed="true"] .sl {
  transform: translateY(-15px);
  fill: var(--c1);
}

.uvq01-crb[aria-pressed="true"] .rpg {
  animation: uvq01-crb-tug calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb[aria-pressed="true"] .a {
  opacity: 0;
  translate: 0 -.5em;
}

.uvq01-crb[aria-pressed="true"] .b {
  opacity: 1;
  translate: 0 0;
}

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

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

@keyframes uvq01-crb-try {
  0%,100% {
    transform: none;
  }
  40% {
    transform: rotate(5deg);
  }
  70% {
    transform: rotate(-1deg);
  }
}

@keyframes uvq01-crb-tug {
  0%,100% {
    transform: none;
  }
  40% {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq01-crb,.uvq01-crb *,.uvq01-crb *::before,.uvq01-crb *::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) {
  el.addEventListener("click",()=>el.setAttribute("aria-pressed",el.getAttribute("aria-pressed")==="true"?"false":"true"))
}

export default function BtnCarabiner() {
  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": "#ff7a1a",
          "--c2": "#2fb5a8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button className="uvq01-crb" type="button" aria-label="Secure" aria-pressed="false"><svg viewBox="0 0 40 60" aria-hidden="true"><g className="rpg"><path className="rp" d="M-2 57C8 45 32 45 42 57" /><path className="rp2" d="M-2 57C8 45 32 45 42 57" /></g><path className="bd" d="M6 16a10 10 0 0 1 10-10h8a10 10 0 0 1 10 10v28a10 10 0 0 1-10 10h-8a10 10 0 0 1-10-10" /><g className="gt"><path d="M6 18v25" /><rect className="sl" x="3" y="33" width="6" height="9" rx="1.8" /></g></svg><span className="w" aria-hidden="true"><span className="a">Secure</span><span className="b">Secured</span></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 “Climbing carabiner button” block (Buttons) from AIMRAN Library to my project.

## What it is
The carabiner gate swings open on hover; on press the locking sleeve slides up, the rope gets a tug and it is secured.

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

## 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-crb {
  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: .8em;
  padding: .45em 1.6em .45em .95em;
  border-radius: 999px;
  color: #f1f3f5;
  background: linear-gradient(180deg,#2c3137,#1b1f24);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.1),0 0 0 1px #0d0f12,0 12px 24px -12px rgba(0,0,0,.6);
  transition: transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.4s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb svg {
  width: 2.1em;
  height: 3.15em;
  overflow: visible;
}

.uvq01-crb .bd {
  fill: none;
  stroke: var(--c1);
  stroke-width: 4.4;
  stroke-linecap: round;
}

.uvq01-crb .gt path {
  fill: none;
  stroke: #c9ced6;
  stroke-width: 3;
  stroke-linecap: round;
}

.uvq01-crb .gt {
  transform-origin: 6px 43px;
  transition: transform calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb .sl {
  fill: #8b939e;
  transition: transform calc(0.45s / var(--k)) cubic-bezier(.22,1,.36,1),fill calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb .rp {
  fill: none;
  stroke: var(--c2);
  stroke-width: 5.5;
  stroke-linecap: round;
}

.uvq01-crb .rp2 {
  fill: none;
  stroke: rgba(255,255,255,.45);
  stroke-width: 5.5;
  stroke-dasharray: 1.6 2.6;
}

.uvq01-crb .w {
  display: grid;
}

.uvq01-crb .a,.uvq01-crb .b {
  grid-area: 1/1;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),translate calc(0.35s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq01-crb .b {
  opacity: 0;
  translate: 0 .5em;
}

.uvq01-crb:hover .gt,.uvq01-crb:focus-visible .gt {
  transform: rotate(24deg);
}

.uvq01-crb[aria-pressed="true"] {
  background: linear-gradient(180deg,color-mix(in srgb,var(--c2) 45%,#1b1f24),#1b1f24);
}

.uvq01-crb[aria-pressed="true"] .gt {
  transform: none;
}

.uvq01-crb[aria-pressed="true"]:hover .gt {
  animation: uvq01-crb-try calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq01-crb[aria-pressed="true"] .sl {
  transform: translateY(-15px);
  fill: var(--c1);
}

.uvq01-crb[aria-pressed="true"] .rpg {
  animation: uvq01-crb-tug calc(0.5s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq01-crb[aria-pressed="true"] .a {
  opacity: 0;
  translate: 0 -.5em;
}

.uvq01-crb[aria-pressed="true"] .b {
  opacity: 1;
  translate: 0 0;
}

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

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

@keyframes uvq01-crb-try {
  0%,100% {
    transform: none;
  }
  40% {
    transform: rotate(5deg);
  }
  70% {
    transform: rotate(-1deg);
  }
}

@keyframes uvq01-crb-tug {
  0%,100% {
    transform: none;
  }
  40% {
    transform: translateY(-4px);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq01-crb,.uvq01-crb *,.uvq01-crb *::before,.uvq01-crb *::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) {
  el.addEventListener("click",()=>el.setAttribute("aria-pressed",el.getAttribute("aria-pressed")==="true"?"false":"true"))
}

export default function BtnCarabiner() {
  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": "#ff7a1a",
          "--c2": "#2fb5a8",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <button className="uvq01-crb" type="button" aria-label="Secure" aria-pressed="false"><svg viewBox="0 0 40 60" aria-hidden="true"><g className="rpg"><path className="rp" d="M-2 57C8 45 32 45 42 57" /><path className="rp2" d="M-2 57C8 45 32 45 42 57" /></g><path className="bd" d="M6 16a10 10 0 0 1 10-10h8a10 10 0 0 1 10 10v28a10 10 0 0 1-10 10h-8a10 10 0 0 1-10-10" /><g className="gt"><path d="M6 18v25" /><rect className="sl" x="3" y="33" width="6" height="9" rx="1.8" /></g></svg><span className="w" aria-hidden="true"><span className="a">Secure</span><span className="b">Secured</span></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.
````
