A setup checklist whose bar fills a third per ticked item and whose counter reads 2 / 3 done. The bar uses :has() to count checked boxes and the counter is a plain CSS counter, no script.
Also known as: checkbox progress bar css, onboarding checklist css, css has checklist.
<div class="chk-checklist-progress-bar">
<label class="chk-checklist-progress-bar-item">
<input type="checkbox" checked>
<span class="chk-checklist-progress-bar-box"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
<span class="chk-checklist-progress-bar-text">Create account</span>
</label>
<label class="chk-checklist-progress-bar-item">
<input type="checkbox">
<span class="chk-checklist-progress-bar-box"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
<span class="chk-checklist-progress-bar-text">Invite your team</span>
</label>
<label class="chk-checklist-progress-bar-item">
<input type="checkbox">
<span class="chk-checklist-progress-bar-box"><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M5 12.5l4.5 4.5L19 7.5"/></svg></span>
<span class="chk-checklist-progress-bar-text">Publish a page</span>
</label>
<div class="chk-checklist-progress-bar-head">
<span class="chk-checklist-progress-bar-title">Getting started</span>
<span class="chk-checklist-progress-bar-count"></span>
</div>
<div class="chk-checklist-progress-bar-track"><span class="chk-checklist-progress-bar-fill"></span></div>
</div>.chk-checklist-progress-bar {
--c: var(--chk-color, #3b82f6);
font-size: var(--chk-size, 24px);
--p: 0;
display: flex;
flex-direction: column;
gap: 0.3em;
width: 12em;
line-height: 1.3;
counter-reset: chk-checklist-progress-bar-done;}
.chk-checklist-progress-bar-head {
order: -2;
display: flex;
justify-content: space-between;
align-items: baseline;
font-size: 0.8em;
}
.chk-checklist-progress-bar-title {
font-weight: 600;
}
.chk-checklist-progress-bar-count {
opacity: 0.65;
font-variant-numeric: tabular-nums;
transition: color 0.3s ease, opacity 0.3s ease;
}
.chk-checklist-progress-bar-count::before {
content: counter(chk-checklist-progress-bar-done) " / 3 done";
}
.chk-checklist-progress-bar-track {
order: -1;
height: 0.32em;
margin-bottom: 0.4em;
border-radius: 1em;
background: color-mix(in srgb, var(--c) 18%, transparent);
overflow: hidden;
}
.chk-checklist-progress-bar-fill {
position: relative;
display: block;
height: 100%;
border-radius: inherit;
background: var(--c);
transform: scaleX(var(--p));
transform-origin: left;
transition: transform 0.5s cubic-bezier(0.65, 0, 0.35, 1);
overflow: hidden;
}
.chk-checklist-progress-bar-fill::after {
content: "";
position: absolute;
inset: 0;
background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.7), transparent);
transform: translateX(-100%);
}
.chk-checklist-progress-bar-item {
position: relative;
display: flex;
align-items: center;
gap: 0.5em;
padding: 0.12em 0;
font-size: 0.85em;
cursor: pointer;
-webkit-user-select: none;
user-select: none;
}
.chk-checklist-progress-bar-item input {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
margin: 0;
opacity: 0;
cursor: pointer;
z-index: 1;
}
.chk-checklist-progress-bar-item input:checked {
counter-increment: chk-checklist-progress-bar-done;
}
.chk-checklist-progress-bar-box {
display: grid;
place-items: center;
flex: none;
width: 1.1em;
height: 1.1em;
border: 0.12em solid color-mix(in srgb, currentColor 38%, transparent);
border-radius: 0.3em;
transition: background-color 0.2s ease, border-color 0.2s ease;
}
.chk-checklist-progress-bar-box svg {
width: 0.8em;
height: 0.8em;
fill: none;
stroke: #fff;
stroke-width: 3.6;
stroke-linecap: round;
stroke-linejoin: round;
stroke-dasharray: 20;
stroke-dashoffset: 20;
transition: stroke-dashoffset 0.2s ease-in;
}
.chk-checklist-progress-bar-text {
transition: opacity 0.3s ease;
}
.chk-checklist-progress-bar-item input:checked + .chk-checklist-progress-bar-box {
background: var(--c);
border-color: var(--c);
}
.chk-checklist-progress-bar-item input:checked + .chk-checklist-progress-bar-box svg {
stroke-dashoffset: 0;
transition: stroke-dashoffset 0.3s ease-out 0.05s;
}
.chk-checklist-progress-bar-item input:checked ~ .chk-checklist-progress-bar-text {
opacity: 0.5;
}
.chk-checklist-progress-bar-item input:focus-visible + .chk-checklist-progress-bar-box {
outline: 0.12em solid var(--c);
outline-offset: 0.18em;
}
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item input:checked) {
--p: 0.3333;
}
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(1) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(2) input:checked),
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(1) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(3) input:checked),
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(2) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(3) input:checked) {
--p: 0.6667;
}
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(1) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(2) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(3) input:checked) {
--p: 1;
}
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(1) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(2) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(3) input:checked) .chk-checklist-progress-bar-count {
color: var(--c);
opacity: 1;
}
.chk-checklist-progress-bar:has(.chk-checklist-progress-bar-item:nth-of-type(1) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(2) input:checked):has(.chk-checklist-progress-bar-item:nth-of-type(3) input:checked) .chk-checklist-progress-bar-fill::after {
animation: chk-checklist-progress-bar-shine 0.9s ease-in-out 0.45s;
}
@keyframes chk-checklist-progress-bar-shine {
to { transform: translateX(100%); }
}
@media (prefers-reduced-motion: reduce) {
.chk-checklist-progress-bar, .chk-checklist-progress-bar *, .chk-checklist-progress-bar::before, .chk-checklist-progress-bar::after, .chk-checklist-progress-bar *::before, .chk-checklist-progress-bar *::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}--chk-color on the element or a parent.
Currently previewing #3b82f6.--chk-size. Every other dimension is in
em, so the whole thing scales together. Currently previewing 24px.transition or animation
shorthand. Staggered delays are relative, so they keep their rhythm.