# #131 — Scrubbable Interactive Timeline

> Multi-lane horizontal timeline with a live playhead scrubber, track filters, zoom scale, and synchronized milestone inspector.

## Metadata

- **Index**: #131
- **Slug**: `scrubbable-horizontal-timeline`
- **Kind**: `ui`
- **Family**: Temporal & Roadmap
- **Theme**: `dark`
- **Mobile Strength**: `high`
- **Tags**: `timeline`, `scrubber`, `roadmap`, `swimlanes`, `interactive-chart`, `chronology`
- **Best For**: Product roadmaps and release histories, Interactive editorial chronologies and journalism, Project milestone and Gantt-lite planners, Museum, documentary, and educational archives
- **Real-World Inspiration**: [Preceden](https://www.preceden.com/)
- **Detail Page**: https://templates.michaelpitts.net/t/scrubbable-horizontal-timeline
- **Live Demo**: https://templates.michaelpitts.net/demos/scrubbable-horizontal-timeline.html
- **JSON API**: https://templates.michaelpitts.net/api/templates/scrubbable-horizontal-timeline

## Why This Aesthetic Is Unique

Pairs a tactile range scrubber and auto-scrubbing playhead needle with multi-track swimlanes so overlapping historical or roadmap periods can be explored fluidly on both desktop and mobile.

## Color Palette

| Role | Name | Hex |
|------|------|-----|
| `canvas` | Archival Night | `#0F131A` |
| `surface` | Deep Slate | `#171D27` |
| `ink` | Parchment Light | `#F3F1EA` |
| `accent` | Playhead Gold | `#EAB308` |
| `muted` | Alloy Gray | `#939EB0` |

## Typography

- **Display**: `Inter`
- **Body**: `Inter`
- **Mono**: `JetBrains Mono`
- **Scale Notes**: 28px mono playhead year readout, 12px milestone bars, 10px sticky track labels, 20px detail card heading.
- **Google Fonts**: https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@600;700&display=swap
  ```html
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@500;600;700&family=JetBrains+Mono:wght@600;700&display=swap">
  ```

## Layout Architecture

Scrubber header + horizontally scrollable multi-lane canvas with sticky track badges + 2-column detail/active-events cards below (stacking to 1 column on <=780px).

## Interaction & Micro-Motion Rules

Dragging the range scrubber or toggling Auto-Scrub sweeps the gold playhead across tracks, auto-scrolling the viewport and updating the Active at Playhead panel live.

## Mobile & Responsive Rules

Keeps the page itself zero-overflow while confining horizontal pan strictly inside the rounded timeline viewport, backed by a full-width thumb scrubber and stacked detail cards.

## Agent Guardrails

### DO
- Confine horizontal timeline panning inside an overflow-x:auto container so the page never overflows.
- Keep swimlane labels position:sticky; left:10px so users never lose track context while scrolling.
- Sync scrubber position with a structured detail card below for effortless mobile reading.

### DON'T
- Never pack long descriptions directly inside narrow timeline bars.
- Avoid tiny <34px clickable milestone bars that are hard to tap on touchscreens.

## Complete Standalone Starter Code

File: `demos/scrubbable-horizontal-timeline.html`

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Scrubbable Interactive Horizontal Timeline — Preceden-Inspired Pattern</title>
<style>
  :root {
    --canvas: #0f131a;
    --surface: #171d27;
    --surface-2: #1f2735;
    --border: rgba(255,255,255,0.1);
    --ink: #f3f1ea;
    --muted: #939eb0;
    --gold: #eab308;
    --cyan: #38bdf8;
    --coral: #fb7185;
    --emerald: #34d399;
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { min-height: 100%; background: var(--canvas); color: var(--ink); font-family: var(--font); overflow-x: hidden; }
  .shell { max-width: 1200px; margin: 0 auto; padding: 18px 16px 36px; display: grid; gap: 16px; }
  .header {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding-bottom: 14px; border-bottom: 1px solid var(--border);
  }
  .title-block h1 { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
  .title-block p { font-size: 13px; color: var(--muted); margin-top: 2px; }
  .controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
  .pill-btn {
    min-height: 40px; padding: 0 12px; border-radius: 999px;
    border: 1px solid var(--border); background: var(--surface);
    color: var(--muted); font: 600 13px var(--font); cursor: pointer;
  }
  .pill-btn.active, .pill-btn:hover { color: var(--ink); border-color: var(--gold); background: rgba(234,179,8,0.12); }

  .scrubber-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 16px;
    display: grid;
    gap: 14px;
  }
  .scrubber-top {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  }
  .year-readout {
    font: 700 28px var(--mono);
    color: var(--gold);
    letter-spacing: -0.02em;
  }
  .range-wrap { display: flex; align-items: center; gap: 12px; width: 100%; }
  .scrubber-range {
    flex: 1;
    height: 36px;
    accent-color: var(--gold);
    cursor: pointer;
  }
  .timeline-viewport {
    position: relative;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: #121721;
    padding: 16px 0 18px;
    scrollbar-color: var(--surface-2) transparent;
  }
  .timeline-canvas {
    position: relative;
    min-height: 250px;
  }
  .axis {
    position: relative;
    height: 28px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 14px;
  }
  .tick {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    font: 600 11px var(--mono);
    color: var(--muted);
  }
  .tick::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 22px;
    width: 1px;
    height: 220px;
    background: rgba(255,255,255,0.05);
    pointer-events: none;
  }
  .playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--gold);
    box-shadow: 0 0 14px rgba(234,179,8,0.6);
    pointer-events: none;
    z-index: 15;
  }
  .playhead::before {
    content: "";
    position: absolute;
    top: 0; left: -5px;
    width: 12px; height: 12px;
    border-radius: 50%;
    background: var(--gold);
  }
  .lane {
    position: relative;
    height: 56px;
    margin-bottom: 10px;
  }
  .lane-label {
    position: sticky;
    left: 10px;
    z-index: 5;
    display: inline-block;
    font: 700 10px var(--mono);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
    background: rgba(18,23,33,0.88);
    padding: 2px 7px;
    border-radius: 5px;
  }
  .bar-item {
    position: absolute;
    top: 20px;
    min-height: 34px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.16);
    color: #fff;
    font: 600 12px var(--font);
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: left;
    transition: transform .12s, box-shadow .12s;
  }
  .bar-item:hover, .bar-item.active {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.45);
    border-color: #fff;
    z-index: 10;
  }

  .detail-grid {
    display: grid;
    grid-template-columns: 1.35fr 0.65fr;
    gap: 16px;
  }
  .detail-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
  }
  .badge {
    display: inline-block;
    font: 700 11px var(--mono);
    text-transform: uppercase;
    padding: 4px 9px;
    border-radius: 999px;
    margin-bottom: 10px;
  }
  .detail-card h2 { font-size: 20px; margin-bottom: 8px; }
  .detail-card p { font-size: 14.5px; line-height: 1.65; color: #cbd5e1; }
  .nearby-list { display: grid; gap: 8px; margin-top: 10px; }
  .nearby-btn {
    width: 100%; min-height: 44px; padding: 8px 12px;
    border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface-2); color: var(--ink);
    display: flex; justify-content: space-between; align-items: center;
    font: 500 13px var(--font); cursor: pointer; text-align: left;
  }
  .nearby-btn.active { border-color: var(--gold); }
  @media (max-width: 780px) {
    .detail-grid { grid-template-columns: 1fr; }
    .year-readout { font-size: 22px; }
  }
</style>
</head>
<body>
<div class="shell">
  <header class="header">
    <div class="title-block">
      <h1>Spaceflight & Web Computing Timeline (1969–2026)</h1>
      <p>Scrub the playhead or tap any milestone bar to inspect historical eras.</p>
    </div>
    <div class="controls" id="trackFilters">
      <button class="pill-btn active" data-track="all" type="button">All Tracks</button>
      <button class="pill-btn" data-track="Spaceflight" type="button">Spaceflight</button>
      <button class="pill-btn" data-track="Computing" type="button">Computing</button>
      <button class="pill-btn" data-track="Web" type="button">Web & UI</button>
    </div>
  </header>

  <section class="scrubber-card">
    <div class="scrubber-top">
      <div>
        <div style="font:600 11px var(--mono);text-transform:uppercase;color:var(--muted);">Playhead Position</div>
        <div class="year-readout" id="yearReadout">1995</div>
      </div>
      <div class="controls">
        <button class="pill-btn" id="playBtn" type="button">▶ Auto-Scrub</button>
        <button class="pill-btn active" data-zoom="1" type="button">1× Era</button>
        <button class="pill-btn" data-zoom="1.8" type="button">1.8× Detail</button>
      </div>
    </div>

    <div class="range-wrap">
      <span style="font:600 12px var(--mono);color:var(--muted);">1969</span>
      <input class="scrubber-range" id="scrubber" type="range" min="1969" max="2026" step="0.2" value="1995" aria-label="Scrub timeline year">
      <span style="font:600 12px var(--mono);color:var(--muted);">2026</span>
    </div>

    <div class="timeline-viewport" id="timelineViewport">
      <div class="timeline-canvas" id="timelineCanvas"></div>
    </div>
  </section>

  <section class="detail-grid">
    <article class="detail-card" id="detailCard"></article>
    <aside class="detail-card">
      <div style="font:700 11px var(--mono);text-transform:uppercase;color:var(--muted);margin-bottom:8px;">Active at Playhead</div>
      <div class="nearby-list" id="nearbyList"></div>
    </aside>
  </section>
</div>

<script>
const MIN_Y = 1969, MAX_Y = 2026;
const EVENTS = [
  { id: 'e1', track: 'Spaceflight', color: '#eab308', start: 1969, end: 1972, title: 'Apollo Lunar Missions', desc: 'Apollo 11 through 17 landed twelve astronauts on the Moon using the 74 KB Apollo Guidance Computer.' },
  { id: 'e2', track: 'Spaceflight', color: '#eab308', start: 1977, end: 1989, title: 'Voyager Grand Tour', desc: 'Twin probes explored Jupiter, Saturn, Uranus, and Neptune before entering interstellar space.' },
  { id: 'e3', track: 'Spaceflight', color: '#eab308', start: 1998, end: 2025, title: 'International Space Station', desc: 'Continuous orbital laboratory assembled across 40+ missions with international crew rotation.' },
  { id: 'e4', track: 'Spaceflight', color: '#eab308', start: 2021, end: 2026, title: 'JWST Deep-Field Era', desc: 'James Webb Space Telescope observes infrared galaxies formed within 300 million years of the Big Bang.' },

  { id: 'e5', track: 'Computing', color: '#38bdf8', start: 1973, end: 1981, title: 'Xerox Alto & Bitmapped GUI', desc: 'Introduced desktop windows, overlapping panes, Ethernet, and the mouse-driven WYSIWYG workstation.' },
  { id: 'e6', track: 'Computing', color: '#38bdf8', start: 1984, end: 1996, title: 'Personal Desktop Revolution', desc: 'Macintosh, NeXTSTEP, and Windows 95 brought direct-manipulation interfaces to millions of homes.' },
  { id: 'e7', track: 'Computing', color: '#38bdf8', start: 2007, end: 2018, title: 'Multi-Touch Mobile Computing', desc: 'Capacitive touchscreens reshaped ergonomics around 44px thumb targets, physics inertia, and fluid sheets.' },
  { id: 'e8', track: 'Computing', color: '#38bdf8', start: 2020, end: 2026, title: 'Neural & Agentic Workspaces', desc: 'On-device accelerators and multimodal reasoning models turn software into collaborative spatial canvases.' },

  { id: 'e9', track: 'Web', color: '#34d399', start: 1990, end: 1999, title: 'Hypertext & Early HTML', desc: 'Tim Berners-Lee launched WorldWideWeb; CSS1 and JavaScript turned static pages into live documents.' },
  { id: 'e10', track: 'Web', color: '#34d399', start: 2004, end: 2013, title: 'Ajax & Responsive Web Design', desc: 'Asynchronous web apps and fluid media queries unified desktop and mobile viewports under one URL.' },
  { id: 'e11', track: 'Web', color: '#34d399', start: 2015, end: 2026, title: 'Design Systems & WebGPU', desc: 'Component tokens, CSS Grid, and hardware-accelerated canvases bring native-grade tools to the browser.' }
];

let activeTrack = 'all';
let zoom = 1;
let playheadYear = 1995;
let selectedId = 'e9';
let playing = false;
let rafId = null;

const canvas = document.getElementById('timelineCanvas');
const viewport = document.getElementById('timelineViewport');
const scrubber = document.getElementById('scrubber');
const yearReadout = document.getElementById('yearReadout');
const detailCard = document.getElementById('detailCard');
const nearbyList = document.getElementById('nearbyList');
const playBtn = document.getElementById('playBtn');

function pct(year) { return ((year - MIN_Y) / (MAX_Y - MIN_Y)) * 100; }

function renderTimeline() {
  const widthPx = Math.max(680, Math.round(980 * zoom));
  canvas.style.width = widthPx + 'px';

  const tracks = activeTrack === 'all' ? ['Spaceflight', 'Computing', 'Web'] : [activeTrack];
  let html = `<div class="playhead" id="playhead" style="left:${pct(playheadYear)}%"></div><div class="axis">`;
  for (let y = 1970; y <= 2025; y += 5) {
    html += `<span class="tick" style="left:${pct(y)}%">${y}</span>`;
  }
  html += `</div>`;

  for (const tr of tracks) {
    const items = EVENTS.filter(e => e.track === tr);
    html += `<div class="lane"><span class="lane-label">${tr}</span>`;
    for (const ev of items) {
      const left = pct(ev.start);
      const w = Math.max(5.5, pct(ev.end) - left);
      html += `<button type="button" class="bar-item ${ev.id === selectedId ? 'active' : ''}" data-id="${ev.id}"
        style="left:${left}%;width:${w}%;background:${ev.color}26;border-color:${ev.id === selectedId ? '#fff' : ev.color + '88'};color:#f8fafc;">
        ${ev.title}
      </button>`;
    }
    html += `</div>`;
  }

  canvas.innerHTML = html;
  canvas.querySelectorAll('.bar-item').forEach(btn => {
    btn.addEventListener('click', () => {
      selectedId = btn.dataset.id;
      const ev = EVENTS.find(e => e.id === selectedId);
      if (ev) {
        playheadYear = Math.round((ev.start + ev.end) / 2);
        scrubber.value = playheadYear;
      }
      updateReadout();
      renderTimeline();
    });
  });
  updateReadout();
}

function updateReadout() {
  yearReadout.textContent = Math.floor(playheadYear);
  const ph = document.getElementById('playhead');
  if (ph) ph.style.left = pct(playheadYear) + '%';

  const active = EVENTS.filter(e =>
    (activeTrack === 'all' || e.track === activeTrack) &&
    playheadYear >= e.start && playheadYear <= e.end
  );

  if (active.length && !active.some(e => e.id === selectedId)) {
    selectedId = active[0].id;
  }
  const cur = EVENTS.find(e => e.id === selectedId) || active[0] || EVENTS[0];

  detailCard.innerHTML = `
    <span class="badge" style="background:${cur.color}22;color:${cur.color};">${cur.track} · ${cur.start}–${cur.end}</span>
    <h2>${cur.title}</h2>
    <p>${cur.desc}</p>
  `;

  nearbyList.innerHTML = active.length ? active.map(ev => `
    <button type="button" class="nearby-btn ${ev.id === cur.id ? 'active' : ''}" data-id="${ev.id}">
      <span>${ev.title}</span>
      <span style="font:600 11px var(--mono);color:${ev.color};">${ev.start}–${ev.end}</span>
    </button>
  `).join('') : `<div style="font-size:13px;color:var(--muted);">No overlapping milestones at ${Math.floor(playheadYear)}.</div>`;

  nearbyList.querySelectorAll('.nearby-btn').forEach(btn => {
    btn.addEventListener('click', () => {
      selectedId = btn.dataset.id;
      renderTimeline();
    });
  });
}

scrubber.addEventListener('input', () => {
  playheadYear = Number(scrubber.value);
  updateReadout();
  const ratio = (playheadYear - MIN_Y) / (MAX_Y - MIN_Y);
  viewport.scrollLeft = Math.max(0, ratio * canvas.scrollWidth - viewport.clientWidth * 0.5);
});

document.getElementById('trackFilters').addEventListener('click', e => {
  const btn = e.target.closest('.pill-btn');
  if (!btn) return;
  activeTrack = btn.dataset.track;
  document.querySelectorAll('#trackFilters .pill-btn').forEach(b => b.classList.toggle('active', b === btn));
  renderTimeline();
});

document.querySelectorAll('[data-zoom]').forEach(btn => {
  btn.addEventListener('click', () => {
    zoom = Number(btn.dataset.zoom);
    document.querySelectorAll('[data-zoom]').forEach(b => b.classList.toggle('active', b === btn));
    renderTimeline();
  });
});

function tick() {
  if (!playing) return;
  playheadYear += 0.12;
  if (playheadYear > MAX_Y) playheadYear = MIN_Y;
  scrubber.value = playheadYear.toFixed(1);
  updateReadout();
  rafId = requestAnimationFrame(tick);
}

playBtn.addEventListener('click', () => {
  playing = !playing;
  playBtn.textContent = playing ? '⏸ Pause' : '▶ Auto-Scrub';
  playBtn.classList.toggle('active', playing);
  if (playing) tick();
  else cancelAnimationFrame(rafId);
});

renderTimeline();
</script>
</body>
</html>
```
