# Tape measure pagination

> Drag a yellow tape measure with inertia until your page sits under the red line, or step through it with the arrows.

- Category: [Navigation](https://library.aimran.es/components/navigation)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-nav-tape-pager
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Pagination drawn as a yellow tape measure: drag it sideways, let go and it keeps sliding with inertia before snapping the nearest page under a red hairline. The arrows, keyboard and a click on any number also work, and the big counter above updates as you go. It suits long galleries, catalogues and archives where scrubbing feels faster than clicking page by page.

The main color sets the tape and the secondary color the hairline. Change the number of pages in the data, and keep the counter above so people always know where they are.

## Code

### HTML

```html
<nav class="uvq12-tp" aria-label="Pagination"><p class="rd"><span>Page</span><b class="pn">7</b><small>/ 24</small></p><div class="cs"><button type="button" class="pv" aria-label="Previous page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6"/></svg></button><div class="vw" role="slider" tabindex="0" aria-label="Page" aria-valuemin="1" aria-valuemax="24" aria-valuenow="7"><div class="tp"><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span><span>19</span><span>20</span><span>21</span><span>22</span><span>23</span><span>24</span></div><i class="hl" aria-hidden="true"></i></div><button type="button" class="nx" aria-label="Next page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6"/></svg></button></div></nav>
```

### CSS

```css
.uvq12-tp {
  --c1: #facc15;
  --c2: #dc2626;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq12-tp {
  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;
  width: 20em;
  --p: 7;
}

.uvq12-tp .rd {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .35em;
  margin: 0 0 .6em;
  font-size: .85em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq12-tp .rd b {
  min-width: 1.2em;
  font-size: 2em;
  font-weight: 800;
  text-align: center;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq12-tp .cs {
  display: flex;
  align-items: center;
  gap: .5em;
}

.uvq12-tp .pv,.uvq12-tp .nx {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.4em 2.8em -1.4em rgba(0,0,0,.45);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-tp .pv svg,.uvq12-tp .nx svg {
  width: 1em;
  height: 1em;
}

.uvq12-tp .pv:active,.uvq12-tp .nx:active {
  transform: scale(.88);
}

.uvq12-tp .pv:disabled,.uvq12-tp .nx:disabled {
  opacity: .35;
  cursor: default;
}

.uvq12-tp button:focus-visible,.uvq12-tp .vw:focus-visible {
  outline: 2px solid var(--c2);
  outline-offset: 3px;
}

.uvq12-tp .vw {
  position: relative;
  flex: none;
  width: 14em;
  height: 3.4em;
  overflow: hidden;
  border-radius: .45em;
  cursor: grab;
  touch-action: pan-y;
  outline: 0;
  background: #1c1917;
  box-shadow: 0 .7em 1.4em -.8em rgba(0,0,0,.55);
}

.uvq12-tp.drag .vw {
  cursor: grabbing;
}

.uvq12-tp .vw::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,rgba(0,0,0,.5),transparent 22%,transparent 78%,rgba(0,0,0,.5)),linear-gradient(180deg,rgba(255,255,255,.25),transparent 30%,transparent 75%,rgba(0,0,0,.18));
}

.uvq12-tp .tp {
  position: absolute;
  left: 0;
  top: .3em;
  bottom: .3em;
  display: flex;
  background: repeating-linear-gradient(90deg,#1c1917 0 1px,transparent 1px .375em) 0 0/100% .55em no-repeat,var(--c1);
  transform: translateX(calc(5.5em - (var(--p) - 1) * 3em));
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
  will-change: transform;
}

.uvq12-tp.drag .tp {
  transition: none;
}

.uvq12-tp .tp span {
  position: relative;
  flex: none;
  width: 3em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .2em;
  font-size: 1em;
  font-weight: 800;
  color: #1c1917;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.uvq12-tp .tp span::before {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
  height: 1.25em;
  background: #1c1917;
}

.uvq12-tp .tp span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: .9em;
  background: #1c1917;
}

.uvq12-tp .tp span.on {
  color: var(--c2);
}

.uvq12-tp .hl {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--c2);
  box-shadow: 0 0 .4em var(--c2);
  pointer-events: none;
}

.uvq12-tp .hl::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -.4em;
  border: .4em solid transparent;
  border-top: .5em solid var(--c2);
}

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

### JavaScript

```js
document.querySelectorAll(".uvq12-tp").forEach(el => {
  const vw=el.querySelector(".vw"),tp=el.querySelector(".tp"),pn=el.querySelector(".pn"),pv=el.querySelector(".pv"),nx=el.querySelector(".nx"),sp=[...tp.children],N=sp.length;let p=7,dn=null;
const go=k=>{p=Math.max(1,Math.min(N,Math.round(k)));el.classList.remove("drag");el.style.setProperty("--p",p);pn.textContent=p;vw.setAttribute("aria-valuenow",p);pv.disabled=p===1;nx.disabled=p===N;sp.forEach((s,j)=>s.classList.toggle("on",j===p-1))};
const unit=()=>parseFloat(getComputedStyle(tp).fontSize)*3*(vw.getBoundingClientRect().width/vw.offsetWidth);
vw.addEventListener("pointerdown",e=>{dn={x:e.clientX,p,u:unit(),t:e.timeStamp,v:0,lx:e.clientX,m:false,f:p}});
vw.addEventListener("pointermove",e=>{if(!dn)return;const dx=e.clientX-dn.x;if(!dn.m&&Math.abs(dx)>4){dn.m=true;el.classList.add("drag");vw.setPointerCapture(e.pointerId)}if(!dn.m)return;const dt=Math.max(1,e.timeStamp-dn.t);dn.v=(e.clientX-dn.lx)/dt;dn.lx=e.clientX;dn.t=e.timeStamp;let f=dn.p-dx/dn.u;if(f<1)f=1-(1-f)*.3;if(f>N)f=N+(f-N)*.3;dn.f=f;el.style.setProperty("--p",f)});
vw.addEventListener("pointerup",e=>{if(!dn)return;const d=dn;dn=null;if(d.m)go(d.f-d.v*200/d.u);else{const s=e.target.closest(".tp span");if(s)go(sp.indexOf(s)+1)}});
vw.addEventListener("pointercancel",()=>{if(dn){dn=null;go(p)}});
vw.addEventListener("keydown",e=>{const m={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-5,PageUp:5}[e.key];if(m){e.preventDefault();go(p+m)}if(e.key==="Home"){e.preventDefault();go(1)}if(e.key==="End"){e.preventDefault();go(N)}});
pv.addEventListener("click",()=>go(p-1));nx.addEventListener("click",()=>go(p+1));go(p)
});
```

### 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 = `
.uvq12-tp {
  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;
  width: 20em;
  --p: 7;
}

.uvq12-tp .rd {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .35em;
  margin: 0 0 .6em;
  font-size: .85em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq12-tp .rd b {
  min-width: 1.2em;
  font-size: 2em;
  font-weight: 800;
  text-align: center;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq12-tp .cs {
  display: flex;
  align-items: center;
  gap: .5em;
}

.uvq12-tp .pv,.uvq12-tp .nx {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.4em 2.8em -1.4em rgba(0,0,0,.45);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-tp .pv svg,.uvq12-tp .nx svg {
  width: 1em;
  height: 1em;
}

.uvq12-tp .pv:active,.uvq12-tp .nx:active {
  transform: scale(.88);
}

.uvq12-tp .pv:disabled,.uvq12-tp .nx:disabled {
  opacity: .35;
  cursor: default;
}

.uvq12-tp button:focus-visible,.uvq12-tp .vw:focus-visible {
  outline: 2px solid var(--c2);
  outline-offset: 3px;
}

.uvq12-tp .vw {
  position: relative;
  flex: none;
  width: 14em;
  height: 3.4em;
  overflow: hidden;
  border-radius: .45em;
  cursor: grab;
  touch-action: pan-y;
  outline: 0;
  background: #1c1917;
  box-shadow: 0 .7em 1.4em -.8em rgba(0,0,0,.55);
}

.uvq12-tp.drag .vw {
  cursor: grabbing;
}

.uvq12-tp .vw::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,rgba(0,0,0,.5),transparent 22%,transparent 78%,rgba(0,0,0,.5)),linear-gradient(180deg,rgba(255,255,255,.25),transparent 30%,transparent 75%,rgba(0,0,0,.18));
}

.uvq12-tp .tp {
  position: absolute;
  left: 0;
  top: .3em;
  bottom: .3em;
  display: flex;
  background: repeating-linear-gradient(90deg,#1c1917 0 1px,transparent 1px .375em) 0 0/100% .55em no-repeat,var(--c1);
  transform: translateX(calc(5.5em - (var(--p) - 1) * 3em));
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
  will-change: transform;
}

.uvq12-tp.drag .tp {
  transition: none;
}

.uvq12-tp .tp span {
  position: relative;
  flex: none;
  width: 3em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .2em;
  font-size: 1em;
  font-weight: 800;
  color: #1c1917;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.uvq12-tp .tp span::before {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
  height: 1.25em;
  background: #1c1917;
}

.uvq12-tp .tp span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: .9em;
  background: #1c1917;
}

.uvq12-tp .tp span.on {
  color: var(--c2);
}

.uvq12-tp .hl {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--c2);
  box-shadow: 0 0 .4em var(--c2);
  pointer-events: none;
}

.uvq12-tp .hl::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -.4em;
  border: .4em solid transparent;
  border-top: .5em solid var(--c2);
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-tp,.uvq12-tp *,.uvq12-tp *::before,.uvq12-tp *::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 vw=el.querySelector(".vw"),tp=el.querySelector(".tp"),pn=el.querySelector(".pn"),pv=el.querySelector(".pv"),nx=el.querySelector(".nx"),sp=[...tp.children],N=sp.length;let p=7,dn=null;
const go=k=>{p=Math.max(1,Math.min(N,Math.round(k)));el.classList.remove("drag");el.style.setProperty("--p",p);pn.textContent=p;vw.setAttribute("aria-valuenow",p);pv.disabled=p===1;nx.disabled=p===N;sp.forEach((s,j)=>s.classList.toggle("on",j===p-1))};
const unit=()=>parseFloat(getComputedStyle(tp).fontSize)*3*(vw.getBoundingClientRect().width/vw.offsetWidth);
vw.addEventListener("pointerdown",e=>{dn={x:e.clientX,p,u:unit(),t:e.timeStamp,v:0,lx:e.clientX,m:false,f:p}});
vw.addEventListener("pointermove",e=>{if(!dn)return;const dx=e.clientX-dn.x;if(!dn.m&&Math.abs(dx)>4){dn.m=true;el.classList.add("drag");vw.setPointerCapture(e.pointerId)}if(!dn.m)return;const dt=Math.max(1,e.timeStamp-dn.t);dn.v=(e.clientX-dn.lx)/dt;dn.lx=e.clientX;dn.t=e.timeStamp;let f=dn.p-dx/dn.u;if(f<1)f=1-(1-f)*.3;if(f>N)f=N+(f-N)*.3;dn.f=f;el.style.setProperty("--p",f)});
vw.addEventListener("pointerup",e=>{if(!dn)return;const d=dn;dn=null;if(d.m)go(d.f-d.v*200/d.u);else{const s=e.target.closest(".tp span");if(s)go(sp.indexOf(s)+1)}});
vw.addEventListener("pointercancel",()=>{if(dn){dn=null;go(p)}});
vw.addEventListener("keydown",e=>{const m={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-5,PageUp:5}[e.key];if(m){e.preventDefault();go(p+m)}if(e.key==="Home"){e.preventDefault();go(1)}if(e.key==="End"){e.preventDefault();go(N)}});
pv.addEventListener("click",()=>go(p-1));nx.addEventListener("click",()=>go(p+1));go(p)
}

export default function NavTapePager() {
  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": "#facc15",
          "--c2": "#dc2626",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <nav className="uvq12-tp" aria-label="Pagination"><p className="rd"><span>Page</span><b className="pn">7</b><small>/ 24</small></p><div className="cs"><button type="button" className="pv" aria-label="Previous page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6" /></svg></button><div className="vw" role="slider" tabIndex={0} aria-label="Page" aria-valuemin="1" aria-valuemax="24" aria-valuenow="7"><div className="tp"><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span><span>19</span><span>20</span><span>21</span><span>22</span><span>23</span><span>24</span></div><i className="hl" aria-hidden="true"></i></div><button type="button" className="nx" aria-label="Next page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6" /></svg></button></div></nav>
      </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 “Tape measure pagination” block (Navigation) from AIMRAN Library to my project.

## What it is
Drag a yellow tape measure with inertia until your page sits under the red line, or step through it with the arrows.

## Chosen settings
- Main color: #facc15
- Secondary color: #dc2626
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Paginación"

## 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 = `
.uvq12-tp {
  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;
  width: 20em;
  --p: 7;
}

.uvq12-tp .rd {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: .35em;
  margin: 0 0 .6em;
  font-size: .85em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq12-tp .rd b {
  min-width: 1.2em;
  font-size: 2em;
  font-weight: 800;
  text-align: center;
  color: var(--fg);
  font-variant-numeric: tabular-nums;
}

.uvq12-tp .cs {
  display: flex;
  align-items: center;
  gap: .5em;
}

.uvq12-tp .pv,.uvq12-tp .nx {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: none;
  display: grid;
  place-items: center;
  width: 2.3em;
  height: 2.3em;
  border-radius: 50%;
  background: color-mix(in srgb,var(--fg) 2%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 9%,transparent),0 1.4em 2.8em -1.4em rgba(0,0,0,.45);
  transition: transform calc(0.2s / var(--k)) cubic-bezier(.34,1.56,.64,1),opacity calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-tp .pv svg,.uvq12-tp .nx svg {
  width: 1em;
  height: 1em;
}

.uvq12-tp .pv:active,.uvq12-tp .nx:active {
  transform: scale(.88);
}

.uvq12-tp .pv:disabled,.uvq12-tp .nx:disabled {
  opacity: .35;
  cursor: default;
}

.uvq12-tp button:focus-visible,.uvq12-tp .vw:focus-visible {
  outline: 2px solid var(--c2);
  outline-offset: 3px;
}

.uvq12-tp .vw {
  position: relative;
  flex: none;
  width: 14em;
  height: 3.4em;
  overflow: hidden;
  border-radius: .45em;
  cursor: grab;
  touch-action: pan-y;
  outline: 0;
  background: #1c1917;
  box-shadow: 0 .7em 1.4em -.8em rgba(0,0,0,.55);
}

.uvq12-tp.drag .vw {
  cursor: grabbing;
}

.uvq12-tp .vw::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg,rgba(0,0,0,.5),transparent 22%,transparent 78%,rgba(0,0,0,.5)),linear-gradient(180deg,rgba(255,255,255,.25),transparent 30%,transparent 75%,rgba(0,0,0,.18));
}

.uvq12-tp .tp {
  position: absolute;
  left: 0;
  top: .3em;
  bottom: .3em;
  display: flex;
  background: repeating-linear-gradient(90deg,#1c1917 0 1px,transparent 1px .375em) 0 0/100% .55em no-repeat,var(--c1);
  transform: translateX(calc(5.5em - (var(--p) - 1) * 3em));
  transition: transform calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
  will-change: transform;
}

.uvq12-tp.drag .tp {
  transition: none;
}

.uvq12-tp .tp span {
  position: relative;
  flex: none;
  width: 3em;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: .2em;
  font-size: 1em;
  font-weight: 800;
  color: #1c1917;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

.uvq12-tp .tp span::before {
  content: "";
  position: absolute;
  left: calc(50% - 1px);
  top: 0;
  width: 2px;
  height: 1.25em;
  background: #1c1917;
}

.uvq12-tp .tp span::after {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 1px;
  height: .9em;
  background: #1c1917;
}

.uvq12-tp .tp span.on {
  color: var(--c2);
}

.uvq12-tp .hl {
  position: absolute;
  z-index: 1;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 2px;
  margin-left: -1px;
  background: var(--c2);
  box-shadow: 0 0 .4em var(--c2);
  pointer-events: none;
}

.uvq12-tp .hl::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  margin-left: -.4em;
  border: .4em solid transparent;
  border-top: .5em solid var(--c2);
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-tp,.uvq12-tp *,.uvq12-tp *::before,.uvq12-tp *::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 vw=el.querySelector(".vw"),tp=el.querySelector(".tp"),pn=el.querySelector(".pn"),pv=el.querySelector(".pv"),nx=el.querySelector(".nx"),sp=[...tp.children],N=sp.length;let p=7,dn=null;
const go=k=>{p=Math.max(1,Math.min(N,Math.round(k)));el.classList.remove("drag");el.style.setProperty("--p",p);pn.textContent=p;vw.setAttribute("aria-valuenow",p);pv.disabled=p===1;nx.disabled=p===N;sp.forEach((s,j)=>s.classList.toggle("on",j===p-1))};
const unit=()=>parseFloat(getComputedStyle(tp).fontSize)*3*(vw.getBoundingClientRect().width/vw.offsetWidth);
vw.addEventListener("pointerdown",e=>{dn={x:e.clientX,p,u:unit(),t:e.timeStamp,v:0,lx:e.clientX,m:false,f:p}});
vw.addEventListener("pointermove",e=>{if(!dn)return;const dx=e.clientX-dn.x;if(!dn.m&&Math.abs(dx)>4){dn.m=true;el.classList.add("drag");vw.setPointerCapture(e.pointerId)}if(!dn.m)return;const dt=Math.max(1,e.timeStamp-dn.t);dn.v=(e.clientX-dn.lx)/dt;dn.lx=e.clientX;dn.t=e.timeStamp;let f=dn.p-dx/dn.u;if(f<1)f=1-(1-f)*.3;if(f>N)f=N+(f-N)*.3;dn.f=f;el.style.setProperty("--p",f)});
vw.addEventListener("pointerup",e=>{if(!dn)return;const d=dn;dn=null;if(d.m)go(d.f-d.v*200/d.u);else{const s=e.target.closest(".tp span");if(s)go(sp.indexOf(s)+1)}});
vw.addEventListener("pointercancel",()=>{if(dn){dn=null;go(p)}});
vw.addEventListener("keydown",e=>{const m={ArrowLeft:-1,ArrowDown:-1,ArrowRight:1,ArrowUp:1,PageDown:-5,PageUp:5}[e.key];if(m){e.preventDefault();go(p+m)}if(e.key==="Home"){e.preventDefault();go(1)}if(e.key==="End"){e.preventDefault();go(N)}});
pv.addEventListener("click",()=>go(p-1));nx.addEventListener("click",()=>go(p+1));go(p)
}

export default function NavTapePager() {
  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": "#facc15",
          "--c2": "#dc2626",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <nav className="uvq12-tp" aria-label="Pagination"><p className="rd"><span>Page</span><b className="pn">7</b><small>/ 24</small></p><div className="cs"><button type="button" className="pv" aria-label="Previous page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M15 6l-6 6 6 6" /></svg></button><div className="vw" role="slider" tabIndex={0} aria-label="Page" aria-valuemin="1" aria-valuemax="24" aria-valuenow="7"><div className="tp"><span>1</span><span>2</span><span>3</span><span>4</span><span>5</span><span>6</span><span>7</span><span>8</span><span>9</span><span>10</span><span>11</span><span>12</span><span>13</span><span>14</span><span>15</span><span>16</span><span>17</span><span>18</span><span>19</span><span>20</span><span>21</span><span>22</span><span>23</span><span>24</span></div><i className="hl" aria-hidden="true"></i></div><button type="button" className="nx" aria-label="Next page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" aria-hidden="true"><path d="M9 6l6 6-6 6" /></svg></button></div></nav>
      </div>
    </>
  );
}
```

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