# Typewriter sheet input

> The paper shifts with every letter like a typewriter carriage, and a little bell rings near the end of the line.

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

## Where to use it

A writing field built around the motion of an old typewriter: the text area sits on a sheet of paper that slides left with each character and springs back on Enter. CSS moves the paper from two variables and a few lines of JavaScript follow the caret. It suits letters, journaling apps and nostalgic landing pages.

Change the enamel and paper colors to match your brand, from olive and cream to black and white. Keep lines short, around thirty characters, and pair it with a plain send button so the machine stays the star.

## Code

### HTML

```html
<div class="uvq06-tw"><div class="win"><div class="pp"><label><span class="sr">Write your letter</span><textarea rows="8" wrap="off" spellcheck="false" placeholder="Write your letter"></textarea></label></div><span class="gd" aria-hidden="true"></span><span class="bl" aria-hidden="true">ding</span></div><div class="pl" aria-hidden="true"><i class="kn"></i><span class="rl"></span><i class="kn"></i></div><div class="ba"><p class="st">Line 1 · Col. 1</p></div></div>
```

### CSS

```css
.uvq06-tw {
  --c1: #3f4f44;
  --c2: #f5edd6;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq06-tw {
  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;
  --col: 0;
  --ln: 0;
}

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

.uvq06-tw .win {
  position: relative;
  height: 8.6em;
  overflow: hidden;
  cursor: text;
  -webkit-mask: linear-gradient(transparent,#000 2.6em);
  mask: linear-gradient(transparent,#000 2.6em);
}

.uvq06-tw .pp {
  position: absolute;
  top: calc(100% - 7.15em);
  left: calc(46% - 3ch);
  padding: 5.2em 3ch 4em;
  font: 500 .95em/1.6 "Courier New",Courier,ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #2b2420;
  background: var(--c2);
  background-image: repeating-linear-gradient(0deg,transparent 0 3px,rgba(120,90,40,.035) 3px 4px);
  box-shadow: 0 0 0 1px rgba(80,60,30,.14),0 .5em 1.2em -.5em rgba(0,0,0,.35);
  translate: calc(var(--col) * -1ch) calc(var(--ln) * -1.6em);
  transition: translate calc(0.08s / var(--k)) linear;
}

.uvq06-tw.cr .pp {
  transition: translate calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-tw .pp.hit {
  animation: uvq06-tw calc(0.12s / var(--k)) linear;
}

.uvq06-tw textarea {
  display: block;
  width: 34ch;
  height: calc(8 * 1.6em);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: none;
  font: inherit;
  line-height: inherit;
  color: inherit;
  caret-color: #b3261e;
  white-space: pre;
  text-shadow: 0 0 .6px rgba(43,36,32,.55);
}

.uvq06-tw textarea::placeholder {
  color: rgba(43,36,32,.38);
}

.uvq06-tw .gd {
  position: absolute;
  left: 46%;
  bottom: 0;
  width: .6em;
  height: .5em;
  background: linear-gradient(90deg,#8d939b,#eef0f2,#8d939b);
  clip-path: polygon(0 100%,50% 0,100% 100%);
}

.uvq06-tw .bl {
  position: absolute;
  right: .6em;
  top: 3em;
  padding: .2em .6em;
  border-radius: 1em;
  font: 700 .7em/1.2 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .08em;
  color: #7c2d12;
  background: #fde68a;
  box-shadow: 0 .3em .8em -.3em rgba(0,0,0,.4);
  opacity: 0;
}

.uvq06-tw .bl.on {
  animation: uvq06-tw-b calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-tw .pl {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .15em;
  margin: 0 -.5em;
}

.uvq06-tw .rl {
  flex: 1;
  height: 1.5em;
  border-radius: .45em;
  background: linear-gradient(#000,#3a3a3a 35%,#1a1a1a 60%,#000);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18),0 .3em .5em -.2em rgba(0,0,0,.5);
}

.uvq06-tw .kn {
  width: 1.1em;
  height: 2.1em;
  border-radius: .35em;
  background: repeating-linear-gradient(0deg,#1f1f1f 0 2px,#3d3d3d 2px 4px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}

.uvq06-tw .ba {
  position: relative;
  margin: -.3em .2em 0;
  padding: 1em 1em .8em;
  border-radius: .4em .4em 1.4em 1.4em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 80%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 75%,#000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1em 1.6em -1em rgba(0,0,0,.55);
}

.uvq06-tw:has(textarea:focus-visible) .ba {
  outline: 2px solid color-mix(in srgb,var(--c1) 60%,var(--fg));
  outline-offset: 3px;
}

.uvq06-tw .st {
  margin: 0;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: color-mix(in srgb,var(--c2) 88%,transparent);
}

@keyframes uvq06-tw {
  50% {
    transform: translateY(.06em);
  }
}

@keyframes uvq06-tw-b {
  0% {
    opacity: 0;
    transform: scale(.4) rotate(-12deg);
  }
  20% {
    opacity: 1;
    transform: scale(1.1) rotate(6deg);
  }
  35% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(3deg);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: none;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq06-tw").forEach(el => {
  const ta=el.querySelector("textarea"),pp=el.querySelector(".pp"),st=el.querySelector(".st"),bl=el.querySelector(".bl");const MC=32,ML=8;let pc=0,pl=0;
ta.value=["Dear Ana,","",""].join("\n");
const pos=()=>{const v=ta.value.slice(0,ta.selectionStart).split("\n");return[v.length-1,v[v.length-1].length]};
const u=()=>{const[l,c]=pos();el.classList.toggle("cr",l!==pl||Math.abs(c-pc)>3);el.style.setProperty("--ln",String(l));el.style.setProperty("--col",String(c));if(c>=MC-4&&pc<MC-4){bl.classList.remove("on");void bl.offsetWidth;bl.classList.add("on")}pc=c;pl=l;st.textContent="Line "+(l+1)+" · Col. "+(c+1)};
ta.addEventListener("beforeinput",e=>{const c=pos()[1];const nl=e.inputType==="insertLineBreak"||e.inputType==="insertParagraph";if(nl?ta.value.split("\n").length>=ML:e.inputType==="insertText"&&c>=MC)e.preventDefault()});
ta.addEventListener("input",()=>{const v=ta.value.split("\n").slice(0,ML).map(s=>s.slice(0,MC)).join("\n");if(v!==ta.value)ta.value=v;pp.classList.remove("hit");void pp.offsetWidth;pp.classList.add("hit");u()});
["keyup","pointerup","focus"].forEach(n=>ta.addEventListener(n,u));
el.querySelector(".win").addEventListener("pointerdown",e=>{if(e.target!==ta){e.preventDefault();ta.focus()}});
ta.setSelectionRange(ta.value.length,ta.value.length);u()
});
```

### 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 = `
.uvq06-tw {
  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;
  --col: 0;
  --ln: 0;
}

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

.uvq06-tw .win {
  position: relative;
  height: 8.6em;
  overflow: hidden;
  cursor: text;
  -webkit-mask: linear-gradient(transparent,#000 2.6em);
  mask: linear-gradient(transparent,#000 2.6em);
}

.uvq06-tw .pp {
  position: absolute;
  top: calc(100% - 7.15em);
  left: calc(46% - 3ch);
  padding: 5.2em 3ch 4em;
  font: 500 .95em/1.6 "Courier New",Courier,ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #2b2420;
  background: var(--c2);
  background-image: repeating-linear-gradient(0deg,transparent 0 3px,rgba(120,90,40,.035) 3px 4px);
  box-shadow: 0 0 0 1px rgba(80,60,30,.14),0 .5em 1.2em -.5em rgba(0,0,0,.35);
  translate: calc(var(--col) * -1ch) calc(var(--ln) * -1.6em);
  transition: translate calc(0.08s / var(--k)) linear;
}

.uvq06-tw.cr .pp {
  transition: translate calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-tw .pp.hit {
  animation: uvq06-tw calc(0.12s / var(--k)) linear;
}

.uvq06-tw textarea {
  display: block;
  width: 34ch;
  height: calc(8 * 1.6em);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: none;
  font: inherit;
  line-height: inherit;
  color: inherit;
  caret-color: #b3261e;
  white-space: pre;
  text-shadow: 0 0 .6px rgba(43,36,32,.55);
}

.uvq06-tw textarea::placeholder {
  color: rgba(43,36,32,.38);
}

.uvq06-tw .gd {
  position: absolute;
  left: 46%;
  bottom: 0;
  width: .6em;
  height: .5em;
  background: linear-gradient(90deg,#8d939b,#eef0f2,#8d939b);
  clip-path: polygon(0 100%,50% 0,100% 100%);
}

.uvq06-tw .bl {
  position: absolute;
  right: .6em;
  top: 3em;
  padding: .2em .6em;
  border-radius: 1em;
  font: 700 .7em/1.2 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .08em;
  color: #7c2d12;
  background: #fde68a;
  box-shadow: 0 .3em .8em -.3em rgba(0,0,0,.4);
  opacity: 0;
}

.uvq06-tw .bl.on {
  animation: uvq06-tw-b calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-tw .pl {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .15em;
  margin: 0 -.5em;
}

.uvq06-tw .rl {
  flex: 1;
  height: 1.5em;
  border-radius: .45em;
  background: linear-gradient(#000,#3a3a3a 35%,#1a1a1a 60%,#000);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18),0 .3em .5em -.2em rgba(0,0,0,.5);
}

.uvq06-tw .kn {
  width: 1.1em;
  height: 2.1em;
  border-radius: .35em;
  background: repeating-linear-gradient(0deg,#1f1f1f 0 2px,#3d3d3d 2px 4px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}

.uvq06-tw .ba {
  position: relative;
  margin: -.3em .2em 0;
  padding: 1em 1em .8em;
  border-radius: .4em .4em 1.4em 1.4em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 80%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 75%,#000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1em 1.6em -1em rgba(0,0,0,.55);
}

.uvq06-tw:has(textarea:focus-visible) .ba {
  outline: 2px solid color-mix(in srgb,var(--c1) 60%,var(--fg));
  outline-offset: 3px;
}

.uvq06-tw .st {
  margin: 0;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: color-mix(in srgb,var(--c2) 88%,transparent);
}

@keyframes uvq06-tw {
  50% {
    transform: translateY(.06em);
  }
}

@keyframes uvq06-tw-b {
  0% {
    opacity: 0;
    transform: scale(.4) rotate(-12deg);
  }
  20% {
    opacity: 1;
    transform: scale(1.1) rotate(6deg);
  }
  35% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(3deg);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: none;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-tw,.uvq06-tw *,.uvq06-tw *::before,.uvq06-tw *::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 ta=el.querySelector("textarea"),pp=el.querySelector(".pp"),st=el.querySelector(".st"),bl=el.querySelector(".bl");const MC=32,ML=8;let pc=0,pl=0;
ta.value=["Dear Ana,","",""].join("\n");
const pos=()=>{const v=ta.value.slice(0,ta.selectionStart).split("\n");return[v.length-1,v[v.length-1].length]};
const u=()=>{const[l,c]=pos();el.classList.toggle("cr",l!==pl||Math.abs(c-pc)>3);el.style.setProperty("--ln",String(l));el.style.setProperty("--col",String(c));if(c>=MC-4&&pc<MC-4){bl.classList.remove("on");void bl.offsetWidth;bl.classList.add("on")}pc=c;pl=l;st.textContent="Line "+(l+1)+" · Col. "+(c+1)};
ta.addEventListener("beforeinput",e=>{const c=pos()[1];const nl=e.inputType==="insertLineBreak"||e.inputType==="insertParagraph";if(nl?ta.value.split("\n").length>=ML:e.inputType==="insertText"&&c>=MC)e.preventDefault()});
ta.addEventListener("input",()=>{const v=ta.value.split("\n").slice(0,ML).map(s=>s.slice(0,MC)).join("\n");if(v!==ta.value)ta.value=v;pp.classList.remove("hit");void pp.offsetWidth;pp.classList.add("hit");u()});
["keyup","pointerup","focus"].forEach(n=>ta.addEventListener(n,u));
el.querySelector(".win").addEventListener("pointerdown",e=>{if(e.target!==ta){e.preventDefault();ta.focus()}});
ta.setSelectionRange(ta.value.length,ta.value.length);u()
}

export default function InTypewriter() {
  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": "#3f4f44",
          "--c2": "#f5edd6",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-tw"><div className="win"><div className="pp"><label><span className="sr">Write your letter</span><textarea rows={8} wrap="off" spellCheck="false" placeholder="Write your letter"></textarea></label></div><span className="gd" aria-hidden="true"></span><span className="bl" aria-hidden="true">ding</span></div><div className="pl" aria-hidden="true"><i className="kn"></i><span className="rl"></span><i className="kn"></i></div><div className="ba"><p className="st">Line 1 · Col. 1</p></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 “Typewriter sheet input” block (Inputs) from AIMRAN Library to my project.

## What it is
The paper shifts with every letter like a typewriter carriage, and a little bell rings near the end of the line.

## Chosen settings
- Main color: #3f4f44
- Secondary color: #f5edd6
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Escribe tu carta"

## 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 = `
.uvq06-tw {
  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;
  --col: 0;
  --ln: 0;
}

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

.uvq06-tw .win {
  position: relative;
  height: 8.6em;
  overflow: hidden;
  cursor: text;
  -webkit-mask: linear-gradient(transparent,#000 2.6em);
  mask: linear-gradient(transparent,#000 2.6em);
}

.uvq06-tw .pp {
  position: absolute;
  top: calc(100% - 7.15em);
  left: calc(46% - 3ch);
  padding: 5.2em 3ch 4em;
  font: 500 .95em/1.6 "Courier New",Courier,ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  color: #2b2420;
  background: var(--c2);
  background-image: repeating-linear-gradient(0deg,transparent 0 3px,rgba(120,90,40,.035) 3px 4px);
  box-shadow: 0 0 0 1px rgba(80,60,30,.14),0 .5em 1.2em -.5em rgba(0,0,0,.35);
  translate: calc(var(--col) * -1ch) calc(var(--ln) * -1.6em);
  transition: translate calc(0.08s / var(--k)) linear;
}

.uvq06-tw.cr .pp {
  transition: translate calc(0.55s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-tw .pp.hit {
  animation: uvq06-tw calc(0.12s / var(--k)) linear;
}

.uvq06-tw textarea {
  display: block;
  width: 34ch;
  height: calc(8 * 1.6em);
  margin: 0;
  padding: 0;
  border: 0;
  outline: 0;
  resize: none;
  overflow: hidden;
  background: none;
  font: inherit;
  line-height: inherit;
  color: inherit;
  caret-color: #b3261e;
  white-space: pre;
  text-shadow: 0 0 .6px rgba(43,36,32,.55);
}

.uvq06-tw textarea::placeholder {
  color: rgba(43,36,32,.38);
}

.uvq06-tw .gd {
  position: absolute;
  left: 46%;
  bottom: 0;
  width: .6em;
  height: .5em;
  background: linear-gradient(90deg,#8d939b,#eef0f2,#8d939b);
  clip-path: polygon(0 100%,50% 0,100% 100%);
}

.uvq06-tw .bl {
  position: absolute;
  right: .6em;
  top: 3em;
  padding: .2em .6em;
  border-radius: 1em;
  font: 700 .7em/1.2 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .08em;
  color: #7c2d12;
  background: #fde68a;
  box-shadow: 0 .3em .8em -.3em rgba(0,0,0,.4);
  opacity: 0;
}

.uvq06-tw .bl.on {
  animation: uvq06-tw-b calc(1.1s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-tw .pl {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: .15em;
  margin: 0 -.5em;
}

.uvq06-tw .rl {
  flex: 1;
  height: 1.5em;
  border-radius: .45em;
  background: linear-gradient(#000,#3a3a3a 35%,#1a1a1a 60%,#000);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18),0 .3em .5em -.2em rgba(0,0,0,.5);
}

.uvq06-tw .kn {
  width: 1.1em;
  height: 2.1em;
  border-radius: .35em;
  background: repeating-linear-gradient(0deg,#1f1f1f 0 2px,#3d3d3d 2px 4px);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.4);
}

.uvq06-tw .ba {
  position: relative;
  margin: -.3em .2em 0;
  padding: 1em 1em .8em;
  border-radius: .4em .4em 1.4em 1.4em;
  background: linear-gradient(color-mix(in srgb,var(--c1) 80%,#fff),var(--c1) 30%,color-mix(in srgb,var(--c1) 75%,#000));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2),0 1em 1.6em -1em rgba(0,0,0,.55);
}

.uvq06-tw:has(textarea:focus-visible) .ba {
  outline: 2px solid color-mix(in srgb,var(--c1) 60%,var(--fg));
  outline-offset: 3px;
}

.uvq06-tw .st {
  margin: 0;
  font: 600 .72em/1 ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: center;
  color: color-mix(in srgb,var(--c2) 88%,transparent);
}

@keyframes uvq06-tw {
  50% {
    transform: translateY(.06em);
  }
}

@keyframes uvq06-tw-b {
  0% {
    opacity: 0;
    transform: scale(.4) rotate(-12deg);
  }
  20% {
    opacity: 1;
    transform: scale(1.1) rotate(6deg);
  }
  35% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(3deg);
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: none;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-tw,.uvq06-tw *,.uvq06-tw *::before,.uvq06-tw *::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 ta=el.querySelector("textarea"),pp=el.querySelector(".pp"),st=el.querySelector(".st"),bl=el.querySelector(".bl");const MC=32,ML=8;let pc=0,pl=0;
ta.value=["Dear Ana,","",""].join("\n");
const pos=()=>{const v=ta.value.slice(0,ta.selectionStart).split("\n");return[v.length-1,v[v.length-1].length]};
const u=()=>{const[l,c]=pos();el.classList.toggle("cr",l!==pl||Math.abs(c-pc)>3);el.style.setProperty("--ln",String(l));el.style.setProperty("--col",String(c));if(c>=MC-4&&pc<MC-4){bl.classList.remove("on");void bl.offsetWidth;bl.classList.add("on")}pc=c;pl=l;st.textContent="Line "+(l+1)+" · Col. "+(c+1)};
ta.addEventListener("beforeinput",e=>{const c=pos()[1];const nl=e.inputType==="insertLineBreak"||e.inputType==="insertParagraph";if(nl?ta.value.split("\n").length>=ML:e.inputType==="insertText"&&c>=MC)e.preventDefault()});
ta.addEventListener("input",()=>{const v=ta.value.split("\n").slice(0,ML).map(s=>s.slice(0,MC)).join("\n");if(v!==ta.value)ta.value=v;pp.classList.remove("hit");void pp.offsetWidth;pp.classList.add("hit");u()});
["keyup","pointerup","focus"].forEach(n=>ta.addEventListener(n,u));
el.querySelector(".win").addEventListener("pointerdown",e=>{if(e.target!==ta){e.preventDefault();ta.focus()}});
ta.setSelectionRange(ta.value.length,ta.value.length);u()
}

export default function InTypewriter() {
  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": "#3f4f44",
          "--c2": "#f5edd6",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-tw"><div className="win"><div className="pp"><label><span className="sr">Write your letter</span><textarea rows={8} wrap="off" spellCheck="false" placeholder="Write your letter"></textarea></label></div><span className="gd" aria-hidden="true"></span><span className="bl" aria-hidden="true">ding</span></div><div className="pl" aria-hidden="true"><i className="kn"></i><span className="rl"></span><i className="kn"></i></div><div className="ba"><p className="st">Line 1 · Col. 1</p></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.
````
