# Sortable table with column filters

> Click a header to sort, click again to reverse, and open a small search field on any column.

- Category: [Filters](https://library.aimran.es/components/filters)
- Built with: HTML + CSS
- Live editor: https://library.aimran.es/blocks/uv-f-desk-table
- Library: AIMRAN Library (https://library.aimran.es), free, no sign-up, by Aimran Oukham

## Where to use it

Tables are still the best way to scan lots of rows. Think of the stock list in a shop's back office, a wholesaler's price list or a club's member list. Clicking a header sorts by that column, and the magnifier opens a filter just for it. Handy if you need a sortable HTML table with column search.

Sorting treats numbers as numbers, so prices come out in the right order. Keep columns few and short on small screens, or switch to cards on phones. For thousands of rows, do the sorting and filtering on the server instead.

## Code

### HTML

```html
<div class="uv-ftt"><table><thead><tr><th data-i="0"><button class="th">Name<i class="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M6 13l6 6 6-6"/></svg></i></button><button class="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-4.3-4.3"/></svg></button><label class="sf"><input placeholder="Filter"></label></th><th data-i="1"><button class="th">Category<i class="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M6 13l6 6 6-6"/></svg></i></button><button class="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-4.3-4.3"/></svg></button><label class="sf"><input placeholder="Filter"></label></th><th data-i="2"><button class="th">Price<i class="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 5v14M6 13l6 6 6-6"/></svg></i></button><button class="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="M20 20l-4.3-4.3"/></svg></button><label class="sf"><input placeholder="Filter"></label></th></tr></thead><tbody><tr><td>Aurora</td><td>Design</td><td>24 €</td></tr><tr><td>Basalto</td><td>Code</td><td>12 €</td></tr><tr><td>Cobalt</td><td>Photos</td><td>38 €</td></tr><tr><td>Duna</td><td>Design</td><td>9 €</td></tr></tbody></table></div>
```

### CSS

```css
.uv-ftt {
  --c1: #0071e3;
  --c2: #8ec5ff;
  --s: 16px;
  /* tamaño */
  --k: 1;
  /* velocidad */
  --fg: #1d1d1f;
  /* texto */
  --bg: #f5f5f7;
  /* fondo */
}

.uv-ftt {
  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: 26em;
  padding: .8em;
  border-radius: 1.2em;
  background: var(--bg);
  box-shadow: 0 14px 40px rgba(0,0,0,.1),inset 0 0 0 1px color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(var(--s) * .87);
}

.uv-ftt th {
  position: relative;
  text-align: left;
  padding: .2em .3em .5em;
  box-shadow: inset 0 -1.5px 0 color-mix(in srgb,var(--fg) 10%,transparent);
  white-space: nowrap;
}

.uv-ftt .th {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: inherit;
  font-weight: 700;
  padding: .35em .4em;
  border-radius: .45em;
}

.uv-ftt .th:hover {
  background: color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt .ar {
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-ftt .ar svg {
  width: .85em;
  height: .85em;
}

.uv-ftt th.srt .ar {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt th.srt.asc .ar {
  transform: rotate(180deg);
}

.uv-ftt .sq {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  padding: .3em;
  border-radius: .4em;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sq svg {
  width: .9em;
  height: .9em;
}

.uv-ftt th:hover .sq {
  opacity: .55;
}

.uv-ftt .sq:hover {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt .sf {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),margin calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt th.f .sf {
  max-height: 3em;
  opacity: 1;
  margin-top: .35em;
}

.uv-ftt .sf input {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 100%;
  box-sizing: border-box;
  padding: .4em .6em;
  border: 0;
  outline: 0;
  border-radius: .5em;
  font-size: calc(var(--s) * .8);
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sf input:focus {
  box-shadow: inset 0 0 0 1.5px var(--c1);
}

.uv-ftt td {
  padding: .55em .65em;
  box-shadow: inset 0 -1px 0 color-mix(in srgb,var(--fg) 6%,transparent);
}

.uv-ftt tbody tr {
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt tbody tr:hover {
  background: color-mix(in srgb,var(--c1) 8%,transparent);
}

.uv-ftt tbody tr.hide {
  display: none;
}
```

### JavaScript

```js
document.querySelectorAll(".uv-ftt").forEach(el => {
  const tb=el.querySelector("tbody"),ths=[...el.querySelectorAll("th")];const rows=()=>[...tb.querySelectorAll("tr")];const flt=()=>{const qs=ths.map(t=>t.querySelector("input").value.trim().toLowerCase());rows().forEach(r=>r.classList.toggle("hide",qs.some((q,i)=>q&&!r.children[i].textContent.toLowerCase().includes(q))))};ths.forEach((th,i)=>{th.querySelector(".th").addEventListener("click",()=>{const asc=!(th.classList.contains("srt")&&!th.classList.contains("asc"));ths.forEach(t=>t.classList.remove("srt","asc"));th.classList.add("srt");if(asc)th.classList.add("asc");rows().sort((a,b)=>{const x=a.children[i].textContent,y=b.children[i].textContent;const n=parseFloat(x)-parseFloat(y);return(isNaN(n)?x.localeCompare(y):n)*(asc?1:-1)}).forEach(r=>tb.appendChild(r))});th.querySelector(".sq").addEventListener("click",()=>{th.classList.toggle("f");if(th.classList.contains("f"))setTimeout(()=>th.querySelector("input").focus(),120)});th.querySelector("input").addEventListener("input",flt)})
});
```

### 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 = `
.uv-ftt {
  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: 26em;
  padding: .8em;
  border-radius: 1.2em;
  background: var(--bg);
  box-shadow: 0 14px 40px rgba(0,0,0,.1),inset 0 0 0 1px color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(var(--s) * .87);
}

.uv-ftt th {
  position: relative;
  text-align: left;
  padding: .2em .3em .5em;
  box-shadow: inset 0 -1.5px 0 color-mix(in srgb,var(--fg) 10%,transparent);
  white-space: nowrap;
}

.uv-ftt .th {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: inherit;
  font-weight: 700;
  padding: .35em .4em;
  border-radius: .45em;
}

.uv-ftt .th:hover {
  background: color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt .ar {
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-ftt .ar svg {
  width: .85em;
  height: .85em;
}

.uv-ftt th.srt .ar {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt th.srt.asc .ar {
  transform: rotate(180deg);
}

.uv-ftt .sq {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  padding: .3em;
  border-radius: .4em;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sq svg {
  width: .9em;
  height: .9em;
}

.uv-ftt th:hover .sq {
  opacity: .55;
}

.uv-ftt .sq:hover {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt .sf {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),margin calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt th.f .sf {
  max-height: 3em;
  opacity: 1;
  margin-top: .35em;
}

.uv-ftt .sf input {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 100%;
  box-sizing: border-box;
  padding: .4em .6em;
  border: 0;
  outline: 0;
  border-radius: .5em;
  font-size: calc(var(--s) * .8);
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sf input:focus {
  box-shadow: inset 0 0 0 1.5px var(--c1);
}

.uv-ftt td {
  padding: .55em .65em;
  box-shadow: inset 0 -1px 0 color-mix(in srgb,var(--fg) 6%,transparent);
}

.uv-ftt tbody tr {
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt tbody tr:hover {
  background: color-mix(in srgb,var(--c1) 8%,transparent);
}

.uv-ftt tbody tr.hide {
  display: none;
}
`;

// 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 tb=el.querySelector("tbody"),ths=[...el.querySelectorAll("th")];const rows=()=>[...tb.querySelectorAll("tr")];const flt=()=>{const qs=ths.map(t=>t.querySelector("input").value.trim().toLowerCase());rows().forEach(r=>r.classList.toggle("hide",qs.some((q,i)=>q&&!r.children[i].textContent.toLowerCase().includes(q))))};ths.forEach((th,i)=>{th.querySelector(".th").addEventListener("click",()=>{const asc=!(th.classList.contains("srt")&&!th.classList.contains("asc"));ths.forEach(t=>t.classList.remove("srt","asc"));th.classList.add("srt");if(asc)th.classList.add("asc");rows().sort((a,b)=>{const x=a.children[i].textContent,y=b.children[i].textContent;const n=parseFloat(x)-parseFloat(y);return(isNaN(n)?x.localeCompare(y):n)*(asc?1:-1)}).forEach(r=>tb.appendChild(r))});th.querySelector(".sq").addEventListener("click",()=>{th.classList.toggle("f");if(th.classList.contains("f"))setTimeout(()=>th.querySelector("input").focus(),120)});th.querySelector("input").addEventListener("input",flt)})
}

export default function FDeskTable() {
  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": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uv-ftt"><table><thead><tr><th data-i="0"><button className="th">Name<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th><th data-i="1"><button className="th">Category<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th><th data-i="2"><button className="th">Price<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th></tr></thead><tbody><tr><td>Aurora</td><td>Design</td><td>24 €</td></tr><tr><td>Basalto</td><td>Code</td><td>12 €</td></tr><tr><td>Cobalt</td><td>Photos</td><td>38 €</td></tr><tr><td>Duna</td><td>Design</td><td>9 €</td></tr></tbody></table></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 “Sortable table with column filters” block (Filters) from AIMRAN Library to my project.

## What it is
Click a header to sort, click again to reverse, and open a small search field on any column.

## Chosen settings
- Main color: #0071e3
- Secondary color: #8ec5ff
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)

## 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 = `
.uv-ftt {
  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: 26em;
  padding: .8em;
  border-radius: 1.2em;
  background: var(--bg);
  box-shadow: 0 14px 40px rgba(0,0,0,.1),inset 0 0 0 1px color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(var(--s) * .87);
}

.uv-ftt th {
  position: relative;
  text-align: left;
  padding: .2em .3em .5em;
  box-shadow: inset 0 -1.5px 0 color-mix(in srgb,var(--fg) 10%,transparent);
  white-space: nowrap;
}

.uv-ftt .th {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  display: inline-flex;
  align-items: center;
  gap: .3em;
  font-size: inherit;
  font-weight: 700;
  padding: .35em .4em;
  border-radius: .45em;
}

.uv-ftt .th:hover {
  background: color-mix(in srgb,var(--fg) 7%,transparent);
}

.uv-ftt .ar {
  display: grid;
  place-items: center;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.4s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uv-ftt .ar svg {
  width: .85em;
  height: .85em;
}

.uv-ftt th.srt .ar {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt th.srt.asc .ar {
  transform: rotate(180deg);
}

.uv-ftt .sq {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  font-size: var(--s);
  font-weight: 550;
  line-height: 1;
  padding: .72em 1.25em;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  background: transparent;
  color: var(--fg);
  position: relative;
  transition: color calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),background calc(0.32s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.32s / var(--k)) cubic-bezier(.34,1.56,.64,1);
  padding: .3em;
  border-radius: .4em;
  opacity: 0;
  transition: opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sq svg {
  width: .9em;
  height: .9em;
}

.uv-ftt th:hover .sq {
  opacity: .55;
}

.uv-ftt .sq:hover {
  opacity: 1;
  color: var(--c1);
}

.uv-ftt .sf {
  display: block;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1),opacity calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1),margin calc(0.35s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt th.f .sf {
  max-height: 3em;
  opacity: 1;
  margin-top: .35em;
}

.uv-ftt .sf input {
  font-family: -apple-system,BlinkMacSystemFont,"SF Pro Text","Inter",system-ui,sans-serif;
  width: 100%;
  box-sizing: border-box;
  padding: .4em .6em;
  border: 0;
  outline: 0;
  border-radius: .5em;
  font-size: calc(var(--s) * .8);
  color: var(--fg);
  background: color-mix(in srgb,var(--fg) 8%,transparent);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt .sf input:focus {
  box-shadow: inset 0 0 0 1.5px var(--c1);
}

.uv-ftt td {
  padding: .55em .65em;
  box-shadow: inset 0 -1px 0 color-mix(in srgb,var(--fg) 6%,transparent);
}

.uv-ftt tbody tr {
  transition: background calc(0.25s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uv-ftt tbody tr:hover {
  background: color-mix(in srgb,var(--c1) 8%,transparent);
}

.uv-ftt tbody tr.hide {
  display: none;
}
`;

// 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 tb=el.querySelector("tbody"),ths=[...el.querySelectorAll("th")];const rows=()=>[...tb.querySelectorAll("tr")];const flt=()=>{const qs=ths.map(t=>t.querySelector("input").value.trim().toLowerCase());rows().forEach(r=>r.classList.toggle("hide",qs.some((q,i)=>q&&!r.children[i].textContent.toLowerCase().includes(q))))};ths.forEach((th,i)=>{th.querySelector(".th").addEventListener("click",()=>{const asc=!(th.classList.contains("srt")&&!th.classList.contains("asc"));ths.forEach(t=>t.classList.remove("srt","asc"));th.classList.add("srt");if(asc)th.classList.add("asc");rows().sort((a,b)=>{const x=a.children[i].textContent,y=b.children[i].textContent;const n=parseFloat(x)-parseFloat(y);return(isNaN(n)?x.localeCompare(y):n)*(asc?1:-1)}).forEach(r=>tb.appendChild(r))});th.querySelector(".sq").addEventListener("click",()=>{th.classList.toggle("f");if(th.classList.contains("f"))setTimeout(()=>th.querySelector("input").focus(),120)});th.querySelector("input").addEventListener("input",flt)})
}

export default function FDeskTable() {
  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": "#0071e3",
          "--c2": "#8ec5ff",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uv-ftt"><table><thead><tr><th data-i="0"><button className="th">Name<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th><th data-i="1"><button className="th">Category<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th><th data-i="2"><button className="th">Price<i className="ar"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round" strokeLinejoin="round"><path d="M12 5v14M6 13l6 6 6-6" /></svg></i></button><button className="sq"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="2.2" strokeLinecap="round"><circle cx="11" cy="11" r="7" /><path d="M20 20l-4.3-4.3" /></svg></button><label className="sf"><input placeholder="Filter" /></label></th></tr></thead><tbody><tr><td>Aurora</td><td>Design</td><td>24 €</td></tr><tr><td>Basalto</td><td>Code</td><td>12 €</td></tr><tr><td>Cobalt</td><td>Photos</td><td>38 €</td></tr><tr><td>Duna</td><td>Design</td><td>9 €</td></tr></tbody></table></div>
      </div>
    </>
  );
}
```

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