Stepper Wizard
A four-step flow with a connecting progress line, completed ticks and Back/Next buttons.
AI prompt
Design a four-step wizard header with numbered circles connected by a line: Account, Address, Payment, Review. The current step is filled near-black with white number, completed steps show a check mark, upcoming steps are outlined grey. The line between steps fills with black as progress advances. Below the header show a short panel with the current step title and placeholder text, and Back / Next buttons; Next becomes "Finish" at the end and then shows "All done". Use aria-current="step" on the active item, an aria-live region announcing "Step 2 of 4: Address", Back disabled on step one. Light minimal style; 300 millisecond line fill with prefers-reduced-motion fallback. Plain HTML, CSS and JavaScript.About this pattern
Definition
A stepper breaks a long task into numbered stages and shows where you are. Completed steps get a check, the current step is highlighted and the remaining steps are muted.
Purpose & UX principles
- Use for checkout, sign-up and setup flows with a fixed number of ordered steps.
- Keep each step short; allow going back without losing data; label steps with nouns ("Address", "Payment").
- Mark the current step with aria-current="step" and announce the step change.
Interaction states
- Upcoming, current, complete; Back disabled on step one; Next becomes "Finish" on the last step; a final done state.
Motion specification
- The connecting line fills over 300ms; the current marker scales 1.1 briefly.
- Reduced motion: line and marker change instantly.
Responsive behaviour
- On narrow screens show only the current step name and "Step 2 of 4" instead of every label.
- Keep Back and Next at the bottom, thumb-reachable.
Code
<div class="bx"><ol class="st" id="st"></ol><div class="pn" id="pn" aria-live="polite"></div><div class="act"><button id="bk" type="button">Back</button><button id="nx" type="button">Next</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}
.bx{width:min(320px,100%);display:grid;gap:12px}
.st{list-style:none;padding:0;display:flex;justify-content:space-between;position:relative}
.st::before,.st::after{content:"";position:absolute;left:14px;top:13px;height:2px;border-radius:1px}
.st::before{right:14px;background:#e1e1dd}
.st::after{width:calc((100% - 28px) * var(--p,0));background:var(--text);transition:width .3s ease}
.st li{position:relative;z-index:1;display:grid;justify-items:center;gap:5px;font-size:11px;color:var(--muted);width:56px}
.st .n{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:700;border:2px solid #d4d4cf;background:var(--bg);transition:background .2s,border-color .2s,transform .2s}
.st li.cur{color:var(--text);font-weight:600}.st li.cur .n{background:var(--text);color:#fff;border-color:var(--text);transform:scale(1.1)}
.st li.done .n{background:var(--text);color:#fff;border-color:var(--text)}
.pn{min-height:70px;padding:12px 14px;border-radius:12px;background:var(--surface);border:1px solid var(--line);font-size:13px}.pn b{display:block;font-size:14px;margin-bottom:2px}.pn span{color:var(--muted)}
.act{display:flex;justify-content:space-between}.act button{height:32px;padding:0 18px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12.5px;cursor:pointer}
#nx{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);font-weight:600}.act button:disabled{opacity:.35;cursor:default}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.st::after,.st .n{transition:none}.st li.cur .n{transform:none}}const S=[['Account','Create your login details.'],['Address','Where should we send your order?'],['Payment','Choose how you want to pay.'],['Review','Check everything before you finish.']],st=document.getElementById('st'),pn=document.getElementById('pn'),bk=document.getElementById('bk'),nx=document.getElementById('nx');let i=0,fin=false;
function draw(){st.style.setProperty('--p',fin?1:i/(S.length-1));st.innerHTML=S.map((s,k)=>'<li class="'+(fin||k<i?'done':k===i?'cur':'')+'"'+(k===i&&!fin?' aria-current="step"':'')+'><span class="n">'+((fin||k<i)?'✓':k+1)+'</span>'+s[0]+'</li>').join('');
pn.innerHTML=fin?'<b>All done</b><span>Your order has been placed.</span>':'<b>Step '+(i+1)+' of '+S.length+': '+S[i][0]+'</b><span>'+S[i][1]+'</span>';bk.disabled=i===0&&!fin;nx.textContent=fin?'Start over':i===S.length-1?'Finish':'Next';}
nx.addEventListener('click',()=>{if(fin){fin=false;i=0;}else if(i===S.length-1)fin=true;else i++;draw();});bk.addEventListener('click',()=>{if(fin)fin=false;else if(i>0)i--;draw();});draw();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>Stepper Wizard — 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}}
.bx{width:min(320px,100%);display:grid;gap:12px}
.st{list-style:none;padding:0;display:flex;justify-content:space-between;position:relative}
.st::before,.st::after{content:"";position:absolute;left:14px;top:13px;height:2px;border-radius:1px}
.st::before{right:14px;background:#e1e1dd}
.st::after{width:calc((100% - 28px) * var(--p,0));background:var(--text);transition:width .3s ease}
.st li{position:relative;z-index:1;display:grid;justify-items:center;gap:5px;font-size:11px;color:var(--muted);width:56px}
.st .n{width:28px;height:28px;border-radius:50%;display:grid;place-items:center;font-size:12px;font-weight:700;border:2px solid #d4d4cf;background:var(--bg);transition:background .2s,border-color .2s,transform .2s}
.st li.cur{color:var(--text);font-weight:600}.st li.cur .n{background:var(--text);color:#fff;border-color:var(--text);transform:scale(1.1)}
.st li.done .n{background:var(--text);color:#fff;border-color:var(--text)}
.pn{min-height:70px;padding:12px 14px;border-radius:12px;background:var(--surface);border:1px solid var(--line);font-size:13px}.pn b{display:block;font-size:14px;margin-bottom:2px}.pn span{color:var(--muted)}
.act{display:flex;justify-content:space-between}.act button{height:32px;padding:0 18px;border-radius:99px;border:1px solid var(--line);background:var(--surface);font-size:12.5px;cursor:pointer}
#nx{background:var(--accent);color:var(--accent-ink);border-color:var(--accent);font-weight:600}.act button:disabled{opacity:.35;cursor:default}
button:focus-visible{outline:2px solid var(--accent);outline-offset:2px}
@media (prefers-reduced-motion:reduce){.st::after,.st .n{transition:none}.st li.cur .n{transform:none}}
</style></head>
<body><div class="stage">
<div class="bx"><ol class="st" id="st"></ol><div class="pn" id="pn" aria-live="polite"></div><div class="act"><button id="bk" type="button">Back</button><button id="nx" type="button">Next</button></div></div>
</div>
<script>
const S=[['Account','Create your login details.'],['Address','Where should we send your order?'],['Payment','Choose how you want to pay.'],['Review','Check everything before you finish.']],st=document.getElementById('st'),pn=document.getElementById('pn'),bk=document.getElementById('bk'),nx=document.getElementById('nx');let i=0,fin=false;
function draw(){st.style.setProperty('--p',fin?1:i/(S.length-1));st.innerHTML=S.map((s,k)=>'<li class="'+(fin||k<i?'done':k===i?'cur':'')+'"'+(k===i&&!fin?' aria-current="step"':'')+'><span class="n">'+((fin||k<i)?'✓':k+1)+'</span>'+s[0]+'</li>').join('');
pn.innerHTML=fin?'<b>All done</b><span>Your order has been placed.</span>':'<b>Step '+(i+1)+' of '+S.length+': '+S[i][0]+'</b><span>'+S[i][1]+'</span>';bk.disabled=i===0&&!fin;nx.textContent=fin?'Start over':i===S.length-1?'Finish':'Next';}
nx.addEventListener('click',()=>{if(fin){fin=false;i=0;}else if(i===S.length-1)fin=true;else i++;draw();});bk.addEventListener('click',()=>{if(fin)fin=false;else if(i>0)i--;draw();});draw();
</script>
</body></html>