# Metro line breadcrumb

> Each level is a station on a metro line, with tilted names and a “You are here” sign that travels when you click.

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

## Where to use it

This breadcrumb draws the path as a metro line: every level is a station, names lean at an angle like on a transit map, and stations after the current one turn grey and dashed. A yellow “You are here” sign rides along the line when you click a station. It uses a real ordered list of links with aria-current, so it works for shops, docs and deep folder structures.

Pick the line color with the main color and the sign with the secondary one. Keep names short so the tilted labels stay readable, and use four to six levels for the clearest map.

## Code

### HTML

```html
<nav class="uvq12-mc" aria-label="Breadcrumb"><div class="ln"><ol><li><a href="#"><span class="st" aria-hidden="true"></span><span class="nm">Home</span></a></li><li><a href="#"><span class="st" aria-hidden="true"></span><span class="nm">Shop</span></a></li><li><a href="#"><span class="st" aria-hidden="true"></span><span class="nm">Men</span></a></li><li><a href="#"><span class="st" aria-hidden="true"></span><span class="nm">Sneakers</span></a></li><li><a href="#" aria-current="page"><span class="st" aria-hidden="true"></span><span class="nm">Running</span></a></li></ol><p class="ah" aria-hidden="true"><b>L5</b><span>You are here</span></p></div></nav>
```

### CSS

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

.uvq12-mc {
  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;
  position: relative;
  width: 22em;
  height: 9em;
  --c: 4;
}

.uvq12-mc .ln {
  position: absolute;
  left: 0;
  right: 3em;
  top: 5.4em;
}

.uvq12-mc ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5,1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.uvq12-mc ol::before,.uvq12-mc ol::after {
  content: "";
  position: absolute;
  left: 10%;
  top: -.24em;
  height: .48em;
  border-radius: 1em;
}

.uvq12-mc ol::before {
  right: 10%;
  background: repeating-linear-gradient(90deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 .7em,transparent .7em 1em);
}

.uvq12-mc ol::after {
  width: calc(var(--c) * 20%);
  background: var(--c1);
  transition: width calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc li {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.uvq12-mc a {
  position: relative;
  display: block;
  width: 1.7em;
  height: 1.7em;
  margin-top: -.85em;
  border-radius: 50%;
  color: var(--fg);
  text-decoration: none;
  outline: 0;
}

.uvq12-mc .st {
  position: absolute;
  inset: .32em;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 .22em var(--c1);
  transition: inset calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq12-mc .fu .st {
  box-shadow: 0 0 0 .22em color-mix(in srgb,var(--fg) 25%,transparent);
}

.uvq12-mc [aria-current] .st {
  inset: .06em;
  animation: uvq12-mc 1.8s ease-out infinite;
}

.uvq12-mc .nm {
  position: absolute;
  left: 55%;
  bottom: calc(100% + .1em);
  white-space: nowrap;
  font-size: .8em;
  font-weight: 650;
  transform: rotate(-38deg);
  transform-origin: 0 100%;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-mc .fu .nm {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-weight: 500;
}

.uvq12-mc [aria-current] .nm {
  color: var(--c1);
  font-weight: 800;
}

.uvq12-mc a:hover .st {
  transform: scale(1.15);
}

.uvq12-mc a:active .st {
  transform: scale(.9);
}

.uvq12-mc a:focus-visible .st {
  outline: 2px solid var(--c1);
  outline-offset: .32em;
}

.uvq12-mc .ah {
  position: absolute;
  top: 1.1em;
  left: calc(10% + var(--c) * 20%);
  display: flex;
  align-items: center;
  gap: .4em;
  margin: 0;
  padding: .28em .6em .28em .28em;
  border-radius: .45em;
  white-space: nowrap;
  font-size: .72em;
  font-weight: 750;
  color: #111;
  background: var(--c2);
  box-shadow: 0 .4em .8em -.4em rgba(0,0,0,.4);
  transform: translateX(-50%);
  transition: left calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc .ah::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -.45em;
  margin-left: -.45em;
  border: .45em solid transparent;
  border-top: 0;
  border-bottom-color: var(--c2);
}

.uvq12-mc .ah b {
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  font-size: .85em;
  color: #fff;
  background: var(--c1);
}

@keyframes uvq12-mc {
  0% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 .3em color-mix(in srgb,var(--c1) 55%,transparent);
  }
  100% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 1.1em transparent;
  }
}

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

### JavaScript

```js
document.querySelectorAll(".uvq12-mc").forEach(el => {
  const ls=[...el.querySelectorAll("a")];const set=k=>{ls.forEach((a,j)=>{if(j===k)a.setAttribute("aria-current","page");else a.removeAttribute("aria-current");a.parentElement.classList.toggle("fu",j>k)});el.style.setProperty("--c",k)};
ls.forEach((a,j)=>{a.addEventListener("click",e=>{e.preventDefault();set(j)});a.addEventListener("keydown",e=>{const n=e.key==="ArrowRight"?j+1:e.key==="ArrowLeft"?j-1:-1;if(n>=0&&n<ls.length){e.preventDefault();ls[n].focus()}})});set(ls.length-1)
});
```

### 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-mc {
  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;
  position: relative;
  width: 22em;
  height: 9em;
  --c: 4;
}

.uvq12-mc .ln {
  position: absolute;
  left: 0;
  right: 3em;
  top: 5.4em;
}

.uvq12-mc ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5,1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.uvq12-mc ol::before,.uvq12-mc ol::after {
  content: "";
  position: absolute;
  left: 10%;
  top: -.24em;
  height: .48em;
  border-radius: 1em;
}

.uvq12-mc ol::before {
  right: 10%;
  background: repeating-linear-gradient(90deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 .7em,transparent .7em 1em);
}

.uvq12-mc ol::after {
  width: calc(var(--c) * 20%);
  background: var(--c1);
  transition: width calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc li {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.uvq12-mc a {
  position: relative;
  display: block;
  width: 1.7em;
  height: 1.7em;
  margin-top: -.85em;
  border-radius: 50%;
  color: var(--fg);
  text-decoration: none;
  outline: 0;
}

.uvq12-mc .st {
  position: absolute;
  inset: .32em;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 .22em var(--c1);
  transition: inset calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq12-mc .fu .st {
  box-shadow: 0 0 0 .22em color-mix(in srgb,var(--fg) 25%,transparent);
}

.uvq12-mc [aria-current] .st {
  inset: .06em;
  animation: uvq12-mc 1.8s ease-out infinite;
}

.uvq12-mc .nm {
  position: absolute;
  left: 55%;
  bottom: calc(100% + .1em);
  white-space: nowrap;
  font-size: .8em;
  font-weight: 650;
  transform: rotate(-38deg);
  transform-origin: 0 100%;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-mc .fu .nm {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-weight: 500;
}

.uvq12-mc [aria-current] .nm {
  color: var(--c1);
  font-weight: 800;
}

.uvq12-mc a:hover .st {
  transform: scale(1.15);
}

.uvq12-mc a:active .st {
  transform: scale(.9);
}

.uvq12-mc a:focus-visible .st {
  outline: 2px solid var(--c1);
  outline-offset: .32em;
}

.uvq12-mc .ah {
  position: absolute;
  top: 1.1em;
  left: calc(10% + var(--c) * 20%);
  display: flex;
  align-items: center;
  gap: .4em;
  margin: 0;
  padding: .28em .6em .28em .28em;
  border-radius: .45em;
  white-space: nowrap;
  font-size: .72em;
  font-weight: 750;
  color: #111;
  background: var(--c2);
  box-shadow: 0 .4em .8em -.4em rgba(0,0,0,.4);
  transform: translateX(-50%);
  transition: left calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc .ah::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -.45em;
  margin-left: -.45em;
  border: .45em solid transparent;
  border-top: 0;
  border-bottom-color: var(--c2);
}

.uvq12-mc .ah b {
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  font-size: .85em;
  color: #fff;
  background: var(--c1);
}

@keyframes uvq12-mc {
  0% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 .3em color-mix(in srgb,var(--c1) 55%,transparent);
  }
  100% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 1.1em transparent;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-mc,.uvq12-mc *,.uvq12-mc *::before,.uvq12-mc *::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 ls=[...el.querySelectorAll("a")];const set=k=>{ls.forEach((a,j)=>{if(j===k)a.setAttribute("aria-current","page");else a.removeAttribute("aria-current");a.parentElement.classList.toggle("fu",j>k)});el.style.setProperty("--c",k)};
ls.forEach((a,j)=>{a.addEventListener("click",e=>{e.preventDefault();set(j)});a.addEventListener("keydown",e=>{const n=e.key==="ArrowRight"?j+1:e.key==="ArrowLeft"?j-1:-1;if(n>=0&&n<ls.length){e.preventDefault();ls[n].focus()}})});set(ls.length-1)
}

export default function NavMetroCrumbs() {
  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": "#0e9f6e",
          "--c2": "#fde047",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <nav className="uvq12-mc" aria-label="Breadcrumb"><div className="ln"><ol><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Home</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Shop</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Men</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Sneakers</span></a></li><li><a href="#" aria-current="page"><span className="st" aria-hidden="true"></span><span className="nm">Running</span></a></li></ol><p className="ah" aria-hidden="true"><b>L5</b><span>You are here</span></p></div></nav>
      </div>
    </>
  );
}
```

## Prompt for AI assistants

Paste this into ChatGPT, Claude, Cursor, v0 or Lovable to adapt the block to your stack (Tailwind, Vue, Svelte…):

````text
I want to add the “Metro line breadcrumb” block (Navigation) from AIMRAN Library to my project.

## What it is
Each level is a station on a metro line, with tilted names and a “You are here” sign that travels when you click.

## Chosen settings
- Main color: #0e9f6e
- Secondary color: #fde047
- Size: 16px (from 12 to 24px)
- Speed: 1x (from 0.5 to 2x)
- Text: "Migas de pan"

## 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-mc {
  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;
  position: relative;
  width: 22em;
  height: 9em;
  --c: 4;
}

.uvq12-mc .ln {
  position: absolute;
  left: 0;
  right: 3em;
  top: 5.4em;
}

.uvq12-mc ol {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5,1fr);
  margin: 0;
  padding: 0;
  list-style: none;
}

.uvq12-mc ol::before,.uvq12-mc ol::after {
  content: "";
  position: absolute;
  left: 10%;
  top: -.24em;
  height: .48em;
  border-radius: 1em;
}

.uvq12-mc ol::before {
  right: 10%;
  background: repeating-linear-gradient(90deg,color-mix(in srgb,var(--fg) 12%,transparent) 0 .7em,transparent .7em 1em);
}

.uvq12-mc ol::after {
  width: calc(var(--c) * 20%);
  background: var(--c1);
  transition: width calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc li {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: center;
}

.uvq12-mc a {
  position: relative;
  display: block;
  width: 1.7em;
  height: 1.7em;
  margin-top: -.85em;
  border-radius: 50%;
  color: var(--fg);
  text-decoration: none;
  outline: 0;
}

.uvq12-mc .st {
  position: absolute;
  inset: .32em;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: 0 0 0 .22em var(--c1);
  transition: inset calc(0.35s / var(--k)) cubic-bezier(.34,1.56,.64,1),box-shadow calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1),transform calc(0.25s / var(--k)) cubic-bezier(.34,1.56,.64,1);
}

.uvq12-mc .fu .st {
  box-shadow: 0 0 0 .22em color-mix(in srgb,var(--fg) 25%,transparent);
}

.uvq12-mc [aria-current] .st {
  inset: .06em;
  animation: uvq12-mc 1.8s ease-out infinite;
}

.uvq12-mc .nm {
  position: absolute;
  left: 55%;
  bottom: calc(100% + .1em);
  white-space: nowrap;
  font-size: .8em;
  font-weight: 650;
  transform: rotate(-38deg);
  transform-origin: 0 100%;
  transition: color calc(0.3s / var(--k)) cubic-bezier(.25,.1,.25,1);
}

.uvq12-mc .fu .nm {
  color: color-mix(in srgb,var(--fg) 55%,transparent);
  font-weight: 500;
}

.uvq12-mc [aria-current] .nm {
  color: var(--c1);
  font-weight: 800;
}

.uvq12-mc a:hover .st {
  transform: scale(1.15);
}

.uvq12-mc a:active .st {
  transform: scale(.9);
}

.uvq12-mc a:focus-visible .st {
  outline: 2px solid var(--c1);
  outline-offset: .32em;
}

.uvq12-mc .ah {
  position: absolute;
  top: 1.1em;
  left: calc(10% + var(--c) * 20%);
  display: flex;
  align-items: center;
  gap: .4em;
  margin: 0;
  padding: .28em .6em .28em .28em;
  border-radius: .45em;
  white-space: nowrap;
  font-size: .72em;
  font-weight: 750;
  color: #111;
  background: var(--c2);
  box-shadow: 0 .4em .8em -.4em rgba(0,0,0,.4);
  transform: translateX(-50%);
  transition: left calc(0.6s / var(--k)) cubic-bezier(.22,1,.36,1);
}

.uvq12-mc .ah::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -.45em;
  margin-left: -.45em;
  border: .45em solid transparent;
  border-top: 0;
  border-bottom-color: var(--c2);
}

.uvq12-mc .ah b {
  display: grid;
  place-items: center;
  width: 1.8em;
  height: 1.8em;
  border-radius: 50%;
  font-size: .85em;
  color: #fff;
  background: var(--c1);
}

@keyframes uvq12-mc {
  0% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 .3em color-mix(in srgb,var(--c1) 55%,transparent);
  }
  100% {
    box-shadow: 0 0 0 .3em var(--c1),0 0 0 1.1em transparent;
  }
}

@media (prefers-reduced-motion:reduce) {
  .uvq12-mc,.uvq12-mc *,.uvq12-mc *::before,.uvq12-mc *::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 ls=[...el.querySelectorAll("a")];const set=k=>{ls.forEach((a,j)=>{if(j===k)a.setAttribute("aria-current","page");else a.removeAttribute("aria-current");a.parentElement.classList.toggle("fu",j>k)});el.style.setProperty("--c",k)};
ls.forEach((a,j)=>{a.addEventListener("click",e=>{e.preventDefault();set(j)});a.addEventListener("keydown",e=>{const n=e.key==="ArrowRight"?j+1:e.key==="ArrowLeft"?j-1:-1;if(n>=0&&n<ls.length){e.preventDefault();ls[n].focus()}})});set(ls.length-1)
}

export default function NavMetroCrumbs() {
  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": "#0e9f6e",
          "--c2": "#fde047",
          "--s": "16px",
          "--k": "1",
          "--fg": "#1d1d1f",
          "--bg": "#f5f5f7",
        } as CSSProperties}
      >
        <nav className="uvq12-mc" aria-label="Breadcrumb"><div className="ln"><ol><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Home</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Shop</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Men</span></a></li><li><a href="#"><span className="st" aria-hidden="true"></span><span className="nm">Sneakers</span></a></li><li><a href="#" aria-current="page"><span className="st" aria-hidden="true"></span><span className="nm">Running</span></a></li></ol><p className="ah" aria-hidden="true"><b>L5</b><span>You are here</span></p></div></nav>
      </div>
    </>
  );
}
```

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