# Split-flap board tabs

> Choosing a tab makes a station departure board spin its flaps letter by letter until it spells the section name.

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

## Where to use it

Tabs paired with a station departure board: when you pick one, every cell of the board flips through random characters and settles on the section name, one cell after another, with the clock ticking in the corner. A line underneath gives a short detail for each tab. The letters come from the tab text, so they follow the language of the page.

The main color sets the characters and the secondary color the board. Ten cells fit most words; raise the count in the data for longer names and keep the details to a few words.

## Code

### HTML

```html
<div class="uvq12-fb"><div class="bd"><p class="hd"><span>Departures</span><time>10:45</time></p><div class="rw" aria-hidden="true"><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span><span class="cl a">&#160;</span></div><div class="pn" role="tabpanel" id="uvq12-fb-p0" aria-labelledby="uvq12-fb-t0">Platform 2</div><div class="pn" role="tabpanel" id="uvq12-fb-p1" aria-labelledby="uvq12-fb-t1" hidden>12 lines</div><div class="pn" role="tabpanel" id="uvq12-fb-p2" aria-labelledby="uvq12-fb-t2" hidden>Every 8 min</div><div class="pn" role="tabpanel" id="uvq12-fb-p3" aria-labelledby="uvq12-fb-t3" hidden>From €1.50</div></div><div role="tablist" aria-label="Departures"><button type="button" role="tab" id="uvq12-fb-t0" aria-selected="true" aria-controls="uvq12-fb-p0" tabindex="0">Home</button><button type="button" role="tab" id="uvq12-fb-t1" aria-selected="false" aria-controls="uvq12-fb-p1" tabindex="-1">Routes</button><button type="button" role="tab" id="uvq12-fb-t2" aria-selected="false" aria-controls="uvq12-fb-p2" tabindex="-1">Timetable</button><button type="button" role="tab" id="uvq12-fb-t3" aria-selected="false" aria-controls="uvq12-fb-p3" tabindex="-1">Fares</button></div></div>
```

### CSS

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

.uvq12-fb {
  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: 19.5em;
}

.uvq12-fb .bd {
  padding: .7em .8em .8em;
  border-radius: .8em;
  color: var(--c1);
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06),0 1.2em 2.4em -1.2em rgba(0,0,0,.6);
}

.uvq12-fb .hd {
  display: flex;
  justify-content: space-between;
  margin: 0 0 .5em;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
  opacity: .75;
}

.uvq12-fb time {
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .1em;
}

.uvq12-fb .rw {
  display: flex;
  gap: .12em;
  perspective: 20em;
}

.uvq12-fb .cl {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  height: 2.3em;
  border-radius: .18em;
  font-size: 1.25em;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg,#2a2a2a 0 50%,#1e1e1e 50%);
  box-shadow: inset 0 .06em 0 rgba(255,255,255,.08),0 .08em .1em rgba(0,0,0,.6);
}

.uvq12-fb .cl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #000;
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.uvq12-fb .cl {
  font-size: 1.15em;
  height: 2em;
}

.uvq12-fb .cl.a {
  animation: uvq12-fb-a calc(0.09s / var(--k)) linear;
}

.uvq12-fb .cl.b {
  animation: uvq12-fb-b calc(0.09s / var(--k)) linear;
}

.uvq12-fb .pn {
  margin-top: .55em;
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .8;
}

.uvq12-fb .pn[hidden] {
  display: none;
}

.uvq12-fb [role="tablist"] {
  display: flex;
  gap: .4em;
  margin-top: .8em;
}

.uvq12-fb [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  padding: .55em .3em;
  border-radius: .5em;
  font-size: .8em;
  font-weight: 700;
  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.15s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-fb [role="tab"]:hover {
  transform: translateY(-.1em);
}

.uvq12-fb [role="tab"]:active {
  transform: scale(.95);
}

.uvq12-fb [role="tab"][aria-selected="true"] {
  color: var(--c1);
  background: var(--c2);
}

.uvq12-fb [role="tab"]:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

@keyframes uvq12-fb-a {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

@keyframes uvq12-fb-b {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq12-fb").forEach(el => {
  const cs=[...el.querySelectorAll(".cl")],tmz=[],tt=el.querySelector("time"),R="ABCDEFGHIJKLMNOPRSTUVZ0123456789",N=cs.length;
const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;
const flip=(c,ch)=>{c.textContent=ch;c.className=c.className==="cl a"?"cl b":"cl a"};
const show=w=>{tmz.splice(0).forEach(clearTimeout);const s=w.toUpperCase().slice(0,N).padEnd(N,"\u00a0");el.dataset.fb=s;const d=55/K();cs.forEach((c,j)=>{const n=rm?0:3+(j%3);for(let k=0;k<n;k++)tmz.push(setTimeout(()=>{if(el.dataset.fb===s)flip(c,R[Math.floor(Math.random()*R.length)])},(j*35+k*d)/K()));tmz.push(setTimeout(()=>flip(c,el.dataset.fb[j]),(j*35+n*d)/K()))});tmz.push(setTimeout(()=>cs.forEach((c,j)=>{if(c.textContent!==el.dataset.fb[j])c.textContent=el.dataset.fb[j]}),(N*35+6*d+100)/K()))};
const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});show(t.textContent.trim());if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
const clk=()=>{const d=new Date();tt.textContent=String(d.getHours()).padStart(2,"0")+":"+String(d.getMinutes()).padStart(2,"0")};clk();const iv=setInterval(clk,10000);
show(tb[0].textContent.trim());return()=>{tmz.forEach(clearTimeout);clearInterval(iv)}
});
```

### 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-fb {
  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: 19.5em;
}

.uvq12-fb .bd {
  padding: .7em .8em .8em;
  border-radius: .8em;
  color: var(--c1);
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06),0 1.2em 2.4em -1.2em rgba(0,0,0,.6);
}

.uvq12-fb .hd {
  display: flex;
  justify-content: space-between;
  margin: 0 0 .5em;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
  opacity: .75;
}

.uvq12-fb time {
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .1em;
}

.uvq12-fb .rw {
  display: flex;
  gap: .12em;
  perspective: 20em;
}

.uvq12-fb .cl {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  height: 2.3em;
  border-radius: .18em;
  font-size: 1.25em;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg,#2a2a2a 0 50%,#1e1e1e 50%);
  box-shadow: inset 0 .06em 0 rgba(255,255,255,.08),0 .08em .1em rgba(0,0,0,.6);
}

.uvq12-fb .cl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #000;
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.uvq12-fb .cl {
  font-size: 1.15em;
  height: 2em;
}

.uvq12-fb .cl.a {
  animation: uvq12-fb-a calc(0.09s / var(--k)) linear;
}

.uvq12-fb .cl.b {
  animation: uvq12-fb-b calc(0.09s / var(--k)) linear;
}

.uvq12-fb .pn {
  margin-top: .55em;
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .8;
}

.uvq12-fb .pn[hidden] {
  display: none;
}

.uvq12-fb [role="tablist"] {
  display: flex;
  gap: .4em;
  margin-top: .8em;
}

.uvq12-fb [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  padding: .55em .3em;
  border-radius: .5em;
  font-size: .8em;
  font-weight: 700;
  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.15s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-fb [role="tab"]:hover {
  transform: translateY(-.1em);
}

.uvq12-fb [role="tab"]:active {
  transform: scale(.95);
}

.uvq12-fb [role="tab"][aria-selected="true"] {
  color: var(--c1);
  background: var(--c2);
}

.uvq12-fb [role="tab"]:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

@keyframes uvq12-fb-a {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

@keyframes uvq12-fb-b {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-fb,.uvq12-fb *,.uvq12-fb *::before,.uvq12-fb *::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 cs=[...el.querySelectorAll(".cl")],tmz=[],tt=el.querySelector("time"),R="ABCDEFGHIJKLMNOPRSTUVZ0123456789",N=cs.length;
const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;
const flip=(c,ch)=>{c.textContent=ch;c.className=c.className==="cl a"?"cl b":"cl a"};
const show=w=>{tmz.splice(0).forEach(clearTimeout);const s=w.toUpperCase().slice(0,N).padEnd(N,"\u00a0");el.dataset.fb=s;const d=55/K();cs.forEach((c,j)=>{const n=rm?0:3+(j%3);for(let k=0;k<n;k++)tmz.push(setTimeout(()=>{if(el.dataset.fb===s)flip(c,R[Math.floor(Math.random()*R.length)])},(j*35+k*d)/K()));tmz.push(setTimeout(()=>flip(c,el.dataset.fb[j]),(j*35+n*d)/K()))});tmz.push(setTimeout(()=>cs.forEach((c,j)=>{if(c.textContent!==el.dataset.fb[j])c.textContent=el.dataset.fb[j]}),(N*35+6*d+100)/K()))};
const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});show(t.textContent.trim());if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
const clk=()=>{const d=new Date();tt.textContent=String(d.getHours()).padStart(2,"0")+":"+String(d.getMinutes()).padStart(2,"0")};clk();const iv=setInterval(clk,10000);
show(tb[0].textContent.trim());return()=>{tmz.forEach(clearTimeout);clearInterval(iv)}
}

export default function NavFlapBoard() {
  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": "#fde68a",
          "--c2": "#111111",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq12-fb"><div className="bd"><p className="hd"><span>Departures</span><time>10:45</time></p><div className="rw" aria-hidden="true"><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span></div><div className="pn" role="tabpanel" id="uvq12-fb-p0" aria-labelledby="uvq12-fb-t0">Platform 2</div><div className="pn" role="tabpanel" id="uvq12-fb-p1" aria-labelledby="uvq12-fb-t1" hidden={true}>12 lines</div><div className="pn" role="tabpanel" id="uvq12-fb-p2" aria-labelledby="uvq12-fb-t2" hidden={true}>Every 8 min</div><div className="pn" role="tabpanel" id="uvq12-fb-p3" aria-labelledby="uvq12-fb-t3" hidden={true}>From €1.50</div></div><div role="tablist" aria-label="Departures"><button type="button" role="tab" id="uvq12-fb-t0" aria-selected="true" aria-controls="uvq12-fb-p0" tabIndex={0}>Home</button><button type="button" role="tab" id="uvq12-fb-t1" aria-selected="false" aria-controls="uvq12-fb-p1" tabIndex={-1}>Routes</button><button type="button" role="tab" id="uvq12-fb-t2" aria-selected="false" aria-controls="uvq12-fb-p2" tabIndex={-1}>Timetable</button><button type="button" role="tab" id="uvq12-fb-t3" aria-selected="false" aria-controls="uvq12-fb-p3" tabIndex={-1}>Fares</button></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 “Split-flap board tabs” block (Navigation) from AIMRAN Library to my project.

## What it is
Choosing a tab makes a station departure board spin its flaps letter by letter until it spells the section name.

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

## 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-fb {
  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: 19.5em;
}

.uvq12-fb .bd {
  padding: .7em .8em .8em;
  border-radius: .8em;
  color: var(--c1);
  background: var(--c2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06),0 1.2em 2.4em -1.2em rgba(0,0,0,.6);
}

.uvq12-fb .hd {
  display: flex;
  justify-content: space-between;
  margin: 0 0 .5em;
  font-size: .6em;
  font-weight: 800;
  letter-spacing: .25em;
  text-transform: uppercase;
  opacity: .75;
}

.uvq12-fb time {
  font-family: ui-monospace,"SF Mono",Menlo,Consolas,monospace;
  letter-spacing: .1em;
}

.uvq12-fb .rw {
  display: flex;
  gap: .12em;
  perspective: 20em;
}

.uvq12-fb .cl {
  position: relative;
  flex: 1;
  display: grid;
  place-items: center;
  height: 2.3em;
  border-radius: .18em;
  font-size: 1.25em;
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg,#2a2a2a 0 50%,#1e1e1e 50%);
  box-shadow: inset 0 .06em 0 rgba(255,255,255,.08),0 .08em .1em rgba(0,0,0,.6);
}

.uvq12-fb .cl::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: #000;
  box-shadow: 0 1px 0 rgba(255,255,255,.05);
}

.uvq12-fb .cl {
  font-size: 1.15em;
  height: 2em;
}

.uvq12-fb .cl.a {
  animation: uvq12-fb-a calc(0.09s / var(--k)) linear;
}

.uvq12-fb .cl.b {
  animation: uvq12-fb-b calc(0.09s / var(--k)) linear;
}

.uvq12-fb .pn {
  margin-top: .55em;
  font-size: .72em;
  font-weight: 600;
  letter-spacing: .05em;
  opacity: .8;
}

.uvq12-fb .pn[hidden] {
  display: none;
}

.uvq12-fb [role="tablist"] {
  display: flex;
  gap: .4em;
  margin-top: .8em;
}

.uvq12-fb [role="tab"] {
  font: inherit;
  color: inherit;
  border: 0;
  margin: 0;
  background: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  flex: 1;
  padding: .55em .3em;
  border-radius: .5em;
  font-size: .8em;
  font-weight: 700;
  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.15s / var(--k)) cubic-bezier(.34,1.56,.64,1),background calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1),color calc(0.2s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-fb [role="tab"]:hover {
  transform: translateY(-.1em);
}

.uvq12-fb [role="tab"]:active {
  transform: scale(.95);
}

.uvq12-fb [role="tab"][aria-selected="true"] {
  color: var(--c1);
  background: var(--c2);
}

.uvq12-fb [role="tab"]:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}

@keyframes uvq12-fb-a {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

@keyframes uvq12-fb-b {
  from {
    transform: rotateX(-70deg);
    filter: brightness(.5);
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-fb,.uvq12-fb *,.uvq12-fb *::before,.uvq12-fb *::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 cs=[...el.querySelectorAll(".cl")],tmz=[],tt=el.querySelector("time"),R="ABCDEFGHIJKLMNOPRSTUVZ0123456789",N=cs.length;
const K=()=>parseFloat(getComputedStyle(el).getPropertyValue("--k"))||1;const rm=matchMedia("(prefers-reduced-motion: reduce)").matches;
const flip=(c,ch)=>{c.textContent=ch;c.className=c.className==="cl a"?"cl b":"cl a"};
const show=w=>{tmz.splice(0).forEach(clearTimeout);const s=w.toUpperCase().slice(0,N).padEnd(N,"\u00a0");el.dataset.fb=s;const d=55/K();cs.forEach((c,j)=>{const n=rm?0:3+(j%3);for(let k=0;k<n;k++)tmz.push(setTimeout(()=>{if(el.dataset.fb===s)flip(c,R[Math.floor(Math.random()*R.length)])},(j*35+k*d)/K()));tmz.push(setTimeout(()=>flip(c,el.dataset.fb[j]),(j*35+n*d)/K()))});tmz.push(setTimeout(()=>cs.forEach((c,j)=>{if(c.textContent!==el.dataset.fb[j])c.textContent=el.dataset.fb[j]}),(N*35+6*d+100)/K()))};
const ps=[...el.querySelectorAll('[role="tabpanel"]')];const tb=[...el.querySelectorAll('[role="tab"]')];const sel=(t,f)=>{const i=tb.indexOf(t);tb.forEach((x,j)=>{x.setAttribute("aria-selected",String(j===i));x.tabIndex=j===i?0:-1});ps.forEach((p,j)=>{p.hidden=j!==i});show(t.textContent.trim());if(f)t.focus()};tb.forEach(t=>t.addEventListener("click",()=>sel(t)));el.addEventListener("keydown",e=>{const i=tb.indexOf(document.activeElement);if(i<0)return;const n={ArrowRight:i+1,ArrowDown:i+1,ArrowLeft:i-1,ArrowUp:i-1,Home:0,End:tb.length-1}[e.key];if(n===undefined)return;e.preventDefault();sel(tb[(n+tb.length)%tb.length],1)});
const clk=()=>{const d=new Date();tt.textContent=String(d.getHours()).padStart(2,"0")+":"+String(d.getMinutes()).padStart(2,"0")};clk();const iv=setInterval(clk,10000);
show(tb[0].textContent.trim());return()=>{tmz.forEach(clearTimeout);clearInterval(iv)}
}

export default function NavFlapBoard() {
  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": "#fde68a",
          "--c2": "#111111",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <div className="uvq12-fb"><div className="bd"><p className="hd"><span>Departures</span><time>10:45</time></p><div className="rw" aria-hidden="true"><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span><span className="cl a">&#160;</span></div><div className="pn" role="tabpanel" id="uvq12-fb-p0" aria-labelledby="uvq12-fb-t0">Platform 2</div><div className="pn" role="tabpanel" id="uvq12-fb-p1" aria-labelledby="uvq12-fb-t1" hidden={true}>12 lines</div><div className="pn" role="tabpanel" id="uvq12-fb-p2" aria-labelledby="uvq12-fb-t2" hidden={true}>Every 8 min</div><div className="pn" role="tabpanel" id="uvq12-fb-p3" aria-labelledby="uvq12-fb-t3" hidden={true}>From €1.50</div></div><div role="tablist" aria-label="Departures"><button type="button" role="tab" id="uvq12-fb-t0" aria-selected="true" aria-controls="uvq12-fb-p0" tabIndex={0}>Home</button><button type="button" role="tab" id="uvq12-fb-t1" aria-selected="false" aria-controls="uvq12-fb-p1" tabIndex={-1}>Routes</button><button type="button" role="tab" id="uvq12-fb-t2" aria-selected="false" aria-controls="uvq12-fb-p2" tabIndex={-1}>Timetable</button><button type="button" role="tab" id="uvq12-fb-t3" aria-selected="false" aria-controls="uvq12-fb-p3" tabIndex={-1}>Fares</button></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.
````
