Step rail
A standalone how-it-works list on the dotted rail; choosing a step fills the line and the dots up to it.
Part of the style
Pixel Caps Manuscript
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/pixel-caps-manuscript/steps/figma.html
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/pixel-caps-manuscript/steps/figma.html and pass that whole HTML document to the html_to_figma tool, so the part "Step rail" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<section class="steps" aria-labelledby="steps-heading">
<h2 class="steps__heading" id="steps-heading">How a page becomes a poem</h2>
<ol class="steps__rail" style="--reach: 1">
<li class="steps__item is-reached">
<button class="steps__pick" type="button" aria-pressed="true">
<span class="steps__dot" aria-hidden="true"></span>
<span class="steps__label">Step 1</span>
</button>
<h3 class="steps__title">Pick a page</h3>
<p class="steps__text">A broadside, an almanac, a notice from a town that no longer exists. Every page we keep is old enough to be anyone's.</p>
</li>
<li class="steps__item">
<button class="steps__pick" type="button" aria-pressed="false">
<span class="steps__dot" aria-hidden="true"></span>
<span class="steps__label">Step 2</span>
</button>
<h3 class="steps__title">Keep a few words</h3>
<p class="steps__text">Read slowly. Tap only the words that belong to you. Everything else turns into a black bar.</p>
</li>
<li class="steps__item">
<button class="steps__pick" type="button" aria-pressed="false">
<span class="steps__dot" aria-hidden="true"></span>
<span class="steps__label">Step 3</span>
</button>
<h3 class="steps__title">Pass it on</h3>
<p class="steps__text">Your poem goes on the wall, and the page goes back in the drawer for the next reader to find something else.</p>
</li>
</ol>
</section>
<style>
.steps {
padding: var(--section-space) var(--edge);
}
.steps__heading {
margin: 0 0 var(--space-xl);
font-family: var(--font-display);
font-size: var(--display-l);
font-weight: 400;
line-height: 1.1;
}
.steps__rail {
position: relative;
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: var(--gap);
margin: 0;
padding: 0;
list-style: none;
}
/* The line runs from the first dot to the last; the black fill grows to the reached dot. */
.steps__rail::before,
.steps__rail::after {
content: "";
position: absolute;
top: calc(var(--tap) / 2 - var(--rule) / 2);
left: calc(var(--dot) / 2);
width: calc((100% - var(--gap) * 2) / 3 * 2 + var(--gap) * 2);
height: var(--rule);
transform-origin: 0 50%;
}
.steps__rail::before {
background: var(--rule-mute);
}
.steps__rail::after {
background: var(--ink);
transform: scaleX(calc((var(--reach) - 1) / 2));
transition: transform var(--step) var(--ease);
}
.steps__item {
position: relative;
z-index: 1;
color: var(--ink-mute);
transition: color var(--step) var(--ease);
}
.steps__item.is-reached {
color: var(--ink);
}
.steps__pick {
display: inline-flex;
align-items: center;
gap: var(--space-m);
min-height: var(--tap);
padding: 0 var(--space-m) 0 0;
border: 0;
background: var(--paper);
color: inherit;
cursor: pointer;
}
.steps__dot {
width: var(--dot);
height: var(--dot);
border: var(--rule) solid currentColor;
border-radius: var(--radius-dot);
background: var(--paper);
transition: background-color var(--step) var(--ease), border-color var(--step) var(--ease);
}
.steps__item.is-reached .steps__dot {
border-color: var(--ink);
background: var(--ink);
}
.steps__label {
font-family: var(--font-display);
font-size: var(--display-m);
line-height: 1;
}
.steps__pick:hover .steps__label,
.steps__pick:focus-visible .steps__label {
text-decoration: underline;
text-decoration-thickness: var(--rule);
text-underline-offset: 4px;
}
.steps__pick:focus-visible {
outline: none;
}
.steps__title {
margin: var(--space-m) 0 var(--space-s);
font-size: var(--text-l);
font-weight: 500;
line-height: 1.3;
}
.steps__text {
max-width: 34ch;
margin: 0;
}
@media (max-width: 48rem) {
.steps__rail {
grid-template-columns: minmax(0, 1fr);
gap: var(--space-l);
}
.steps__rail::before,
.steps__rail::after {
display: none;
}
.steps__item:not(:last-child)::before {
content: "";
position: absolute;
z-index: -1;
top: calc(var(--tap) / 2);
bottom: calc(var(--space-l) * -1 - var(--tap) / 2);
left: calc(var(--dot) / 2 - var(--rule) / 2);
width: var(--rule);
background: var(--rule-mute);
transition: background-color var(--step) var(--ease);
}
.steps__item:has(+ .is-reached)::before {
background: var(--ink);
}
.steps__title,
.steps__text {
margin-left: calc(var(--dot) + var(--space-m));
}
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.steps')) {
const rail = root.querySelector('.steps__rail');
const items = [...root.querySelectorAll('.steps__item')];
items.forEach((item, index) => {
item.querySelector('.steps__pick').addEventListener('click', () => {
rail.style.setProperty('--reach', String(index + 1));
items.forEach((other, i) => {
other.classList.toggle('is-reached', i <= index);
other.querySelector('.steps__pick').setAttribute('aria-pressed', String(i === index));
});
});
});
}
})();
</script>