# Comment box with mentions

> Type an at sign and a list of people pops up; the chosen mention stays highlighted right inside the text.

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

## Where to use it

A comment field that behaves like the ones in team tools. Typing @ opens an accessible combobox with avatars and roles, filtered as you type and driven by the arrow keys, Enter or Tab. Picked names are highlighted inside the text area itself with a mirror layer behind the transparent field, so the native editing, undo and spellcheck keep working.

Replace the people list with your own team and set the main color for the highlight and the focus ring. It fits task comments, code review notes and chat composers, and the mirror trick works for hashtags or variables with a different pattern.

## Code

### HTML

```html
<div class="uvq06-mn"><label for="uvq06-mn-in" class="lb">Comment</label><div class="fd"><div class="bk" aria-hidden="true"></div><textarea id="uvq06-mn-in" rows="3" role="combobox" aria-expanded="false" aria-controls="uvq06-mn-ls" aria-autocomplete="list" placeholder="Type @ to mention"></textarea><ul id="uvq06-mn-ls" role="listbox" aria-label="People" hidden><li role="option" id="uvq06-mn-o0" data-n="Lucía Martín" aria-selected="false"><i style="--a:#f97316">LM</i><span>Lucía Martín</span><em>Design</em></li><li role="option" id="uvq06-mn-o1" data-n="Pablo Ortega" aria-selected="false"><i style="--a:#0ea5e9">PO</i><span>Pablo Ortega</span><em>Product</em></li><li role="option" id="uvq06-mn-o2" data-n="Marta Ruiz" aria-selected="false"><i style="--a:#16a34a">MR</i><span>Marta Ruiz</span><em>Development</em></li><li role="option" id="uvq06-mn-o3" data-n="Jorge Sanz" aria-selected="false"><i style="--a:#a855f7">JS</i><span>Jorge Sanz</span><em>Sales</em></li><li role="option" id="uvq06-mn-o4" data-n="Nuria Vidal" aria-selected="false"><i style="--a:#e11d48">NV</i><span>Nuria Vidal</span><em>Marketing</em></li></ul></div><p class="ht">Type @ and pick with the arrows and Enter</p></div>
```

### CSS

```css
.uvq06-mn {
  --c1: #0891b2;
  --c2: #cffafe;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uvq06-mn {
  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: 19em;
}

.uvq06-mn .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-mn .fd {
  position: relative;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-mn .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-mn .bk,.uvq06-mn textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: .75em .9em;
  font: inherit;
  line-height: 1.5;
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.uvq06-mn .bk {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  pointer-events: none;
}

.uvq06-mn .bk mark {
  color: transparent;
  border-radius: .3em;
  background: color-mix(in srgb,var(--c1) 22%,transparent);
  box-shadow: 0 0 0 .12em color-mix(in srgb,var(--c1) 22%,transparent);
}

.uvq06-mn textarea {
  position: relative;
  display: block;
  height: 5.5em;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--fg);
  caret-color: var(--c1);
  scrollbar-width: none;
}

.uvq06-mn textarea::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .4em);
  z-index: 3;
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-mn calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-mn [hidden] {
  display: none!important;
}

.uvq06-mn li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6em;
  padding: .4em .5em;
  border-radius: .6em;
  font-size: .86em;
  cursor: pointer;
}

.uvq06-mn li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

.uvq06-mn li i {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  font-size: .72em;
  font-style: normal;
  font-weight: 800;
  color: #fff;
  background: var(--a);
}

.uvq06-mn li span {
  font-weight: 600;
}

.uvq06-mn li em {
  font-size: .82em;
  font-style: normal;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn .ht {
  margin: .5em 0 0;
  font-size: .74em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

@keyframes uvq06-mn {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq06-mn").forEach(el => {
  const ta=el.querySelector("textarea"),ls=el.querySelector("ul"),bk=el.querySelector(".bk"),os=[...ls.children];let q=null,act=0,vis=[];
const RE=new RegExp("@("+os.map(o=>o.dataset.n).join("|")+")","g");
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const paint=()=>{bk.innerHTML=ta.value.replace(/[&<>]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[c]).replace(RE,"<mark>$&</mark>")+"\n ";bk.scrollTop=ta.scrollTop};
const at=()=>{const v=ta.value.slice(0,ta.selectionStart),m=v.match(/(^|\s)@([\p{L}]*)$/u);return m?{s:v.length-m[2].length-1,q:m[2]}:null};
const close=()=>{ls.hidden=true;ta.setAttribute("aria-expanded","false");ta.removeAttribute("aria-activedescendant");act=0};
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])ta.setAttribute("aria-activedescendant",vis[act].id)};
const show=()=>{q=at();vis=q?os.filter(o=>norm(o.dataset.n).includes(norm(q.q))):[];os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;ta.setAttribute("aria-expanded","true");act=Math.min(act,vis.length-1);mark()};
const pick=o=>{if(!q)return;const n="@"+o.dataset.n+" ",a=ta.value.slice(0,q.s),b=ta.value.slice(ta.selectionStart);ta.value=a+n+b;const p=a.length+n.length;ta.focus();ta.setSelectionRange(p,p);close();paint()};
ta.addEventListener("input",()=>{paint();show()});
ta.addEventListener("keydown",e=>{if(ls.hidden)return;if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"||e.key==="Tab"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ta.addEventListener("scroll",()=>{bk.scrollTop=ta.scrollTop});ta.addEventListener("blur",close);ta.addEventListener("click",show);
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
ta.value="Great work, @Marta Ruiz. Shall we review it tomorrow with ";paint()
});
```

### 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-mn {
  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: 19em;
}

.uvq06-mn .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-mn .fd {
  position: relative;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-mn .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-mn .bk,.uvq06-mn textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: .75em .9em;
  font: inherit;
  line-height: 1.5;
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.uvq06-mn .bk {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  pointer-events: none;
}

.uvq06-mn .bk mark {
  color: transparent;
  border-radius: .3em;
  background: color-mix(in srgb,var(--c1) 22%,transparent);
  box-shadow: 0 0 0 .12em color-mix(in srgb,var(--c1) 22%,transparent);
}

.uvq06-mn textarea {
  position: relative;
  display: block;
  height: 5.5em;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--fg);
  caret-color: var(--c1);
  scrollbar-width: none;
}

.uvq06-mn textarea::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .4em);
  z-index: 3;
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-mn calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-mn [hidden] {
  display: none!important;
}

.uvq06-mn li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6em;
  padding: .4em .5em;
  border-radius: .6em;
  font-size: .86em;
  cursor: pointer;
}

.uvq06-mn li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

.uvq06-mn li i {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  font-size: .72em;
  font-style: normal;
  font-weight: 800;
  color: #fff;
  background: var(--a);
}

.uvq06-mn li span {
  font-weight: 600;
}

.uvq06-mn li em {
  font-size: .82em;
  font-style: normal;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn .ht {
  margin: .5em 0 0;
  font-size: .74em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

@keyframes uvq06-mn {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-mn,.uvq06-mn *,.uvq06-mn *::before,.uvq06-mn *::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"),ls=el.querySelector("ul"),bk=el.querySelector(".bk"),os=[...ls.children];let q=null,act=0,vis=[];
const RE=new RegExp("@("+os.map(o=>o.dataset.n).join("|")+")","g");
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const paint=()=>{bk.innerHTML=ta.value.replace(/[&<>]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[c]).replace(RE,"<mark>$&</mark>")+"\n ";bk.scrollTop=ta.scrollTop};
const at=()=>{const v=ta.value.slice(0,ta.selectionStart),m=v.match(/(^|\s)@([\p{L}]*)$/u);return m?{s:v.length-m[2].length-1,q:m[2]}:null};
const close=()=>{ls.hidden=true;ta.setAttribute("aria-expanded","false");ta.removeAttribute("aria-activedescendant");act=0};
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])ta.setAttribute("aria-activedescendant",vis[act].id)};
const show=()=>{q=at();vis=q?os.filter(o=>norm(o.dataset.n).includes(norm(q.q))):[];os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;ta.setAttribute("aria-expanded","true");act=Math.min(act,vis.length-1);mark()};
const pick=o=>{if(!q)return;const n="@"+o.dataset.n+" ",a=ta.value.slice(0,q.s),b=ta.value.slice(ta.selectionStart);ta.value=a+n+b;const p=a.length+n.length;ta.focus();ta.setSelectionRange(p,p);close();paint()};
ta.addEventListener("input",()=>{paint();show()});
ta.addEventListener("keydown",e=>{if(ls.hidden)return;if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"||e.key==="Tab"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ta.addEventListener("scroll",()=>{bk.scrollTop=ta.scrollTop});ta.addEventListener("blur",close);ta.addEventListener("click",show);
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
ta.value="Great work, @Marta Ruiz. Shall we review it tomorrow with ";paint()
}

export default function InMention() {
  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": "#0891b2",
          "--c2": "#cffafe",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-mn"><label htmlFor="uvq06-mn-in" className="lb">Comment</label><div className="fd"><div className="bk" aria-hidden="true"></div><textarea id="uvq06-mn-in" rows={3} role="combobox" aria-expanded="false" aria-controls="uvq06-mn-ls" aria-autocomplete="list" placeholder="Type @ to mention"></textarea><ul id="uvq06-mn-ls" role="listbox" aria-label="People" hidden={true}><li role="option" id="uvq06-mn-o0" data-n="Lucía Martín" aria-selected="false"><i style={{ "--a": "#f97316" } as CSSProperties}>LM</i><span>Lucía Martín</span><em>Design</em></li><li role="option" id="uvq06-mn-o1" data-n="Pablo Ortega" aria-selected="false"><i style={{ "--a": "#0ea5e9" } as CSSProperties}>PO</i><span>Pablo Ortega</span><em>Product</em></li><li role="option" id="uvq06-mn-o2" data-n="Marta Ruiz" aria-selected="false"><i style={{ "--a": "#16a34a" } as CSSProperties}>MR</i><span>Marta Ruiz</span><em>Development</em></li><li role="option" id="uvq06-mn-o3" data-n="Jorge Sanz" aria-selected="false"><i style={{ "--a": "#a855f7" } as CSSProperties}>JS</i><span>Jorge Sanz</span><em>Sales</em></li><li role="option" id="uvq06-mn-o4" data-n="Nuria Vidal" aria-selected="false"><i style={{ "--a": "#e11d48" } as CSSProperties}>NV</i><span>Nuria Vidal</span><em>Marketing</em></li></ul></div><p className="ht">Type @ and pick with the arrows and Enter</p></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 “Comment box with mentions” block (Inputs) from AIMRAN Library to my project.

## What it is
Type an at sign and a list of people pops up; the chosen mention stays highlighted right inside the text.

## Chosen settings
- Main color: #0891b2
- Secondary color: #cffafe
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Comentario"

## 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-mn {
  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: 19em;
}

.uvq06-mn .lb {
  display: block;
  margin: 0 0 .45em;
  font-size: .82em;
  font-weight: 650;
}

.uvq06-mn .fd {
  position: relative;
  border-radius: 1em;
  background: color-mix(in srgb,var(--fg) 3%,var(--bg));
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq06-mn .fd:focus-within {
  box-shadow: 0 0 0 2px var(--c1),0 0 0 6px color-mix(in srgb,var(--c1) 18%,transparent),0 14px 34px -24px rgba(0,0,0,.45);
}

.uvq06-mn .bk,.uvq06-mn textarea {
  box-sizing: border-box;
  width: 100%;
  margin: 0;
  padding: .75em .9em;
  font: inherit;
  line-height: 1.5;
  letter-spacing: normal;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: normal;
}

.uvq06-mn .bk {
  position: absolute;
  inset: 0;
  overflow: hidden;
  color: transparent;
  pointer-events: none;
}

.uvq06-mn .bk mark {
  color: transparent;
  border-radius: .3em;
  background: color-mix(in srgb,var(--c1) 22%,transparent);
  box-shadow: 0 0 0 .12em color-mix(in srgb,var(--c1) 22%,transparent);
}

.uvq06-mn textarea {
  position: relative;
  display: block;
  height: 5.5em;
  border: 0;
  outline: 0;
  resize: none;
  background: none;
  color: var(--fg);
  caret-color: var(--c1);
  scrollbar-width: none;
}

.uvq06-mn textarea::placeholder {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn ul {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + .4em);
  z-index: 3;
  margin: 0;
  padding: .3em;
  list-style: none;
  border-radius: .9em;
  background: var(--bg);
  box-shadow: 0 0 0 1px color-mix(in srgb,var(--fg) 12%,transparent),0 1em 2em -.8em rgba(0,0,0,.45);
  transform-origin: 50% 0;
  animation: uvq06-mn calc(0.22s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq06-mn [hidden] {
  display: none!important;
}

.uvq06-mn li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: .6em;
  padding: .4em .5em;
  border-radius: .6em;
  font-size: .86em;
  cursor: pointer;
}

.uvq06-mn li[aria-selected="true"] {
  background: color-mix(in srgb,var(--c1) 14%,transparent);
}

.uvq06-mn li i {
  display: grid;
  place-items: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  font-size: .72em;
  font-style: normal;
  font-weight: 800;
  color: #fff;
  background: var(--a);
}

.uvq06-mn li span {
  font-weight: 600;
}

.uvq06-mn li em {
  font-size: .82em;
  font-style: normal;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

.uvq06-mn .ht {
  margin: .5em 0 0;
  font-size: .74em;
  color: color-mix(in srgb,var(--fg) 55%,transparent);
}

@keyframes uvq06-mn {
  from {
    opacity: 0;
    transform: translateY(-.3em) scale(.97);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq06-mn,.uvq06-mn *,.uvq06-mn *::before,.uvq06-mn *::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"),ls=el.querySelector("ul"),bk=el.querySelector(".bk"),os=[...ls.children];let q=null,act=0,vis=[];
const RE=new RegExp("@("+os.map(o=>o.dataset.n).join("|")+")","g");
const norm=s=>s.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLowerCase();
const paint=()=>{bk.innerHTML=ta.value.replace(/[&<>]/g,c=>({"&":"&amp;","<":"&lt;",">":"&gt;"})[c]).replace(RE,"<mark>$&</mark>")+"\n ";bk.scrollTop=ta.scrollTop};
const at=()=>{const v=ta.value.slice(0,ta.selectionStart),m=v.match(/(^|\s)@([\p{L}]*)$/u);return m?{s:v.length-m[2].length-1,q:m[2]}:null};
const close=()=>{ls.hidden=true;ta.setAttribute("aria-expanded","false");ta.removeAttribute("aria-activedescendant");act=0};
const mark=()=>{os.forEach(o=>o.setAttribute("aria-selected",String(o===vis[act])));if(vis[act])ta.setAttribute("aria-activedescendant",vis[act].id)};
const show=()=>{q=at();vis=q?os.filter(o=>norm(o.dataset.n).includes(norm(q.q))):[];os.forEach(o=>o.hidden=!vis.includes(o));if(!vis.length)return close();ls.hidden=false;ta.setAttribute("aria-expanded","true");act=Math.min(act,vis.length-1);mark()};
const pick=o=>{if(!q)return;const n="@"+o.dataset.n+" ",a=ta.value.slice(0,q.s),b=ta.value.slice(ta.selectionStart);ta.value=a+n+b;const p=a.length+n.length;ta.focus();ta.setSelectionRange(p,p);close();paint()};
ta.addEventListener("input",()=>{paint();show()});
ta.addEventListener("keydown",e=>{if(ls.hidden)return;if(e.key==="ArrowDown"||e.key==="ArrowUp"){e.preventDefault();act=(act+(e.key==="ArrowDown"?1:-1)+vis.length)%vis.length;mark()}else if(e.key==="Enter"||e.key==="Tab"){e.preventDefault();pick(vis[act])}else if(e.key==="Escape"){e.preventDefault();close()}});
ta.addEventListener("scroll",()=>{bk.scrollTop=ta.scrollTop});ta.addEventListener("blur",close);ta.addEventListener("click",show);
ls.addEventListener("pointerdown",e=>e.preventDefault());
os.forEach(o=>{o.addEventListener("click",()=>pick(o));o.addEventListener("pointermove",()=>{const k=vis.indexOf(o);if(k>-1&&k!==act){act=k;mark()}})});
ta.value="Great work, @Marta Ruiz. Shall we review it tomorrow with ";paint()
}

export default function InMention() {
  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": "#0891b2",
          "--c2": "#cffafe",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq06-mn"><label htmlFor="uvq06-mn-in" className="lb">Comment</label><div className="fd"><div className="bk" aria-hidden="true"></div><textarea id="uvq06-mn-in" rows={3} role="combobox" aria-expanded="false" aria-controls="uvq06-mn-ls" aria-autocomplete="list" placeholder="Type @ to mention"></textarea><ul id="uvq06-mn-ls" role="listbox" aria-label="People" hidden={true}><li role="option" id="uvq06-mn-o0" data-n="Lucía Martín" aria-selected="false"><i style={{ "--a": "#f97316" } as CSSProperties}>LM</i><span>Lucía Martín</span><em>Design</em></li><li role="option" id="uvq06-mn-o1" data-n="Pablo Ortega" aria-selected="false"><i style={{ "--a": "#0ea5e9" } as CSSProperties}>PO</i><span>Pablo Ortega</span><em>Product</em></li><li role="option" id="uvq06-mn-o2" data-n="Marta Ruiz" aria-selected="false"><i style={{ "--a": "#16a34a" } as CSSProperties}>MR</i><span>Marta Ruiz</span><em>Development</em></li><li role="option" id="uvq06-mn-o3" data-n="Jorge Sanz" aria-selected="false"><i style={{ "--a": "#a855f7" } as CSSProperties}>JS</i><span>Jorge Sanz</span><em>Sales</em></li><li role="option" id="uvq06-mn-o4" data-n="Nuria Vidal" aria-selected="false"><i style={{ "--a": "#e11d48" } as CSSProperties}>NV</i><span>Nuria Vidal</span><em>Marketing</em></li></ul></div><p className="ht">Type @ and pick with the arrows and Enter</p></div>
      </div>
    </>
  );
}
```

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