Timeline Playhead Milestones
A playhead travels along a timeline and lights up each milestone as it passes; drag the slider to scrub.
AI prompt
Clean explainer graphic of a horizontal timeline with five milestones labelled 2019 Founded, 2020 First product, 2022 Series A, 2024 One million users and 2026 Global launch, the line filled in dark up to the third dot where a round playhead sits, earlier dots filled, later dots hollow and faint, a card above the current milestone showing its title and one line of detail, flat vector style, generous white space. Negative: gradients, shadows, clutter, text errors, 3D. Reduced motion: static graphic.About this pattern
Definition
A timeline explainer shows events in order along a line. A playhead moves from left to right; when it reaches a milestone the dot fills and its label appears. Scrubbing lets the viewer move back and forth without restarting.
When to use it
- Space milestones by real time if the gaps matter, otherwise evenly.
- The filled part of the line shows what has happened; the rest stays faint.
- Show only the current milestone's detail so the screen never gets crowded.
What the controls do
- Play or Pause and a Position slider across five milestones.
Motion & timing
- Play runs about 6 seconds end to end; the playhead moves at constant speed.
- Reduced motion: no autoplay; scrub with the slider.
Tips & variations
- Provide both Play and a scrub slider; some people need to pause and read.
- Give each milestone a text label, not only a dot.
Code of this live preview
<div class="bx"><div class="tl" id="tl"><div class="rl"><i id="fl"></i></div><b class="ph" id="ph"></b></div><div class="cd" id="cd" aria-live="polite"></div><div class="two"><label class="rw">Position <b id="pv">0%</b><input id="ps" type="range" min="0" max="100" value="0"></label><button class="mini" id="pl" type="button">Play</button></div></div>:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tl{position:relative;height:74px;margin:0 8px}.rl{position:absolute;left:0;right:0;top:34px;height:4px;border-radius:2px;background:var(--line)}.rl i{display:block;height:100%;width:0;background:#171717;border-radius:2px}.mk{position:absolute;top:28px;width:16px;height:16px;margin-left:-8px;border-radius:50%;background:#fff;border:2px solid #bbb;transition:background .2s,border-color .2s}.mk.on{background:#171717;border-color:#171717}
.yr{position:absolute;top:50px;font-size:10.5px;color:var(--muted);transform:translateX(-50%)}.ph{position:absolute;top:24px;width:24px;height:24px;margin-left:-12px;border-radius:50%;background:#2b59d6;box-shadow:0 0 0 5px rgba(43,89,214,.2)}
.cd{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:10px 12px;min-height:56px;font-size:12.5px;margin-bottom:8px}.cd b{display:block;font-size:13.5px}.cd span{color:var(--muted)}
.mini{height:30px;padding:0 14px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:600;cursor:pointer}.mini:disabled{opacity:.4;cursor:default}.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media (prefers-reduced-motion:reduce){.mk{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}const M=[[0,'2019','Founded','Two people and a prototype.'],[25,'2020','First product','The first release goes public.'],[50,'2022','Series A','Funding to grow the team.'],[75,'2024','One million users','A milestone for the community.'],[100,'2026','Global launch','Available in every region.']],tl=document.getElementById('tl'),ps=document.getElementById('ps'),pl=document.getElementById('pl'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let pos=0,play=false,last=0;
tl.insertAdjacentHTML('afterbegin',M.map(m=>'<i class="mk" style="left:'+m[0]+'%"></i><span class="yr" style="left:'+m[0]+'%">'+m[1]+'</span>').join(''));const mk=[...tl.querySelectorAll('.mk')];
function up(){document.getElementById('fl').style.width=pos+'%';document.getElementById('ph').style.left=pos+'%';let cur=0;M.forEach((m,i)=>{const on=pos>=m[0]-.01;mk[i].classList.toggle('on',on);if(on)cur=i;});const m=M[cur];document.getElementById('cd').innerHTML='<b>'+m[1]+': '+m[2]+'</b><span>'+m[3]+'</span>';ps.value=Math.round(pos);document.getElementById('pv').textContent=Math.round(pos)+'%';}
function loop(n){if(!play)return;pos=Math.min(100,pos+(n-last)/60);last=n;up();if(pos>=100){play=false;pl.textContent='Replay';return;}requestAnimationFrame(loop);}
pl.addEventListener('click',()=>{if(play){play=false;pl.textContent='Play';return;}if(pos>=100)pos=0;play=true;pl.textContent='Pause';requestAnimationFrame(n=>{last=n;loop(n);});});
ps.addEventListener('input',()=>{play=false;pl.textContent='Play';pos=+ps.value;up();});up();if(!calm)setTimeout(()=>pl.click(),400);One complete HTML file. Save it and open it in a browser.
<!doctype html>
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>Timeline Playhead Milestones — demo</title>
<style>
:root{--bg:#F1F1EF;--surface:#fff;--surface-2:#F7F7F5;--line:#E0E0DC;--text:#171717;--muted:#6f6f6f;--accent:#171717;--accent-ink:#fff;--danger:#d92d20}
*{box-sizing:border-box;margin:0}
html,body{height:100%}body{background:var(--bg);color:var(--text);font:15px/1.5 -apple-system,BlinkMacSystemFont,'Segoe UI',Inter,Roboto,sans-serif;-webkit-font-smoothing:antialiased}.stage{min-height:100%;display:grid;place-items:center;padding:24px}button,input,select,textarea{font-family:inherit}@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}a{color:inherit;text-decoration:none}ul,ol,p,h4{margin:0;padding:0}.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.pre{display:flex;gap:5px;flex-wrap:wrap}.pre button{height:28px;padding:0 11px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:11px;cursor:pointer}
.pre button[aria-pressed=true]{background:var(--accent);color:var(--accent-ink);border-color:var(--accent)}
.bx{width:min(330px,100%);display:grid;gap:9px}.rw{display:grid;gap:3px;font-size:11.5px;color:var(--muted)}.rw b{color:var(--text);font-weight:600}input[type=range]{width:100%;accent-color:#171717}
.out{font-size:12px;color:var(--muted);line-height:1.4}.out b{color:var(--text)}
button:focus-visible,input:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
.tl{position:relative;height:74px;margin:0 8px}.rl{position:absolute;left:0;right:0;top:34px;height:4px;border-radius:2px;background:var(--line)}.rl i{display:block;height:100%;width:0;background:#171717;border-radius:2px}.mk{position:absolute;top:28px;width:16px;height:16px;margin-left:-8px;border-radius:50%;background:#fff;border:2px solid #bbb;transition:background .2s,border-color .2s}.mk.on{background:#171717;border-color:#171717}
.yr{position:absolute;top:50px;font-size:10.5px;color:var(--muted);transform:translateX(-50%)}.ph{position:absolute;top:24px;width:24px;height:24px;margin-left:-12px;border-radius:50%;background:#2b59d6;box-shadow:0 0 0 5px rgba(43,89,214,.2)}
.cd{border:1px solid var(--line);border-radius:12px;background:var(--surface);padding:10px 12px;min-height:56px;font-size:12.5px;margin-bottom:8px}.cd b{display:block;font-size:13.5px}.cd span{color:var(--muted)}
.mini{height:30px;padding:0 14px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12px;font-weight:600;cursor:pointer}.mini:disabled{opacity:.4;cursor:default}.two{display:grid;grid-template-columns:1fr 1fr;gap:12px}@media (prefers-reduced-motion:reduce){.mk{transition:none}}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}
</style></head>
<body><div class="stage">
<div class="bx"><div class="tl" id="tl"><div class="rl"><i id="fl"></i></div><b class="ph" id="ph"></b></div><div class="cd" id="cd" aria-live="polite"></div><div class="two"><label class="rw">Position <b id="pv">0%</b><input id="ps" type="range" min="0" max="100" value="0"></label><button class="mini" id="pl" type="button">Play</button></div></div>
</div>
<script>
const M=[[0,'2019','Founded','Two people and a prototype.'],[25,'2020','First product','The first release goes public.'],[50,'2022','Series A','Funding to grow the team.'],[75,'2024','One million users','A milestone for the community.'],[100,'2026','Global launch','Available in every region.']],tl=document.getElementById('tl'),ps=document.getElementById('ps'),pl=document.getElementById('pl'),calm=matchMedia('(prefers-reduced-motion:reduce)').matches;let pos=0,play=false,last=0;
tl.insertAdjacentHTML('afterbegin',M.map(m=>'<i class="mk" style="left:'+m[0]+'%"></i><span class="yr" style="left:'+m[0]+'%">'+m[1]+'</span>').join(''));const mk=[...tl.querySelectorAll('.mk')];
function up(){document.getElementById('fl').style.width=pos+'%';document.getElementById('ph').style.left=pos+'%';let cur=0;M.forEach((m,i)=>{const on=pos>=m[0]-.01;mk[i].classList.toggle('on',on);if(on)cur=i;});const m=M[cur];document.getElementById('cd').innerHTML='<b>'+m[1]+': '+m[2]+'</b><span>'+m[3]+'</span>';ps.value=Math.round(pos);document.getElementById('pv').textContent=Math.round(pos)+'%';}
function loop(n){if(!play)return;pos=Math.min(100,pos+(n-last)/60);last=n;up();if(pos>=100){play=false;pl.textContent='Replay';return;}requestAnimationFrame(loop);}
pl.addEventListener('click',()=>{if(play){play=false;pl.textContent='Play';return;}if(pos>=100)pos=0;play=true;pl.textContent='Pause';requestAnimationFrame(n=>{last=n;loop(n);});});
ps.addEventListener('input',()=>{play=false;pl.textContent='Play';pos=+ps.value;up();});up();if(!calm)setTimeout(()=>pl.click(),400);
</script>
</body></html>