DataPremium

Step Progress Indicator

A row of numbered dots joined by a line: two classes in the HTML say where things stand, and the dot that becomes the current step beats once.

CSSSteps

Updated

This effect is part of Effect.Labs — 846 vanilla effects, some free, some premium. Data has 28 effects, including 1 free. Explore the category →

3 usage examples

Fixing a flat tyre in five steps — tutorial of a community bike workshop — Step Progress Indicator example 1

① Fixing a flat tyre in five steps — tutorial of a community bike workshop

WhenThe tutorial is read one step at a time. Five dots in the top bar; below, the step of the moment and the “Next step” button. On each press the dot left behind turns green and the next one, in orange, beats once.
WhyWith greasy hands you want to see at a glance how many steps are left. Five numbers in a slim bar are enough; the beat confirms the press was taken into account.
SettingsFive li, --spi-dot-size: 32px, --spi-line-max: 38px, --spi-active: #e2572b, --spi-done: #2f7d5b, --spi-idle: #ebe4d6, transparent background, --spi-min-height: 0. The buttons move the classes, aria-current and the mentions read aloud. In the scene, a click anywhere but on “Back” counts as “Next step”.
Progress of alterations — order book of a sewing workshop — Step Progress Indicator example 2

② Progress of alterations — order book of a sewing workshop

WhenFive orders, one per row: the garment, the customer, then four tiny dots (received, pinned, sewn, pressed) and the step in plain words. When the seamstress confirms a step on her tablet, the row's violet dot moves one notch.
WhyAt the counter, “is it ready?” is answered without opening the order: the row with four green dots stands out. Each row's state is written by the server in the HTML, with no script line per indicator.
SettingsFive roots of four steps, --spi-dot-size: 14px, --spi-line-max: 20px, --spi-active: #7a3fc4, --spi-done: #2c9a74, font-size: 0 on the root to hide the numbers (still read out). At that size the beat is only a pixel and a half: the colour change is what shows. In the scene, two updates arrive on the first pointer movement.
A bread maker's cycle: kneading, rising, baking — its companion app screen — Step Progress Indicator example 3

③ A bread maker's cycle: kneading, rising, baking — its companion app screen

WhenThe tracking screen of a loaf in progress: time left in large type, then four big dots with their name and duration. The machine goes from kneading to rising, then to baking; each time the orange dot moves and beats.
WhyNobody presses anything: the machine moves on. The beat catches the eye at the exact moment the step changes, with no animation spinning during the two hours the screen sits on the worktop.
SettingsFour li, --spi-dot-size: 52px, --spi-line-max: 62px, font-size: 17px on the root, --spi-active: #e08a2c, --spi-done: #6f8f4e. Names and durations printed by the page on a grid of four 114 px columns (dot + line). In the scene, time is sped up: the two step changes follow each other a second apart.

How it works

An ordered list ol.spi-steps, one li.spi-step per step, a number inside span.spi-dot. The state comes from no computation: you add spi-done to the steps already passed and spi-current to the one you are on. The former turn green, the latter indigo, the rest stay pale.

The line joining two dots belongs to the right-hand dot (it is its ::before). It turns green as soon as that dot is passed or current; dot colours fade over 0.3 s, the line colour switches sharply.

The only motion: the current dot grows by 10% and comes back, in half a second. It happens when the indicator comes on screen, and again each time spi-current is put on another dot. The script provided is a dozen lines long: it waits until half of the block is visible, then adds the spi-on class that allows the beat.

The row tightens by itself. Each line is at most --spi-line-max long and shrinks down to 12 px when room is short; the dots keep their size. There is no caption under the numbers: the indicator is meant to stay small.

Accessibility

  • Reading: an ordered list named by aria-label; Chromium exposes its items as “1 (completed)”, “2 (completed)”, “3 (in progress)”, “4”. The words in brackets are span.spi-sr elements written in the HTML, invisible on screen.
  • Yours to handle when the step changes: move the two classes, but also aria-current="step" and those mentions. The code does not update them.
  • Animations limited by the user: no beat and no fade, colours switch at once.
  • Not a menu: the dots are neither links nor buttons. To go back to a step on click, wrap the number in a real link or button, with a visible focus.
  • Green and indigo look alike to some colour-blind people: position in the row and the beat help, but spell the step out in words nearby.

Browser compatibility

A flex row, custom properties, @keyframes; IntersectionObserver to wait for the indicator to appear. In Chromium 149, Firefox 151 and WebKit 26.5: the current dot reaches scale 1.10 at 250 ms and is back to 1 at 600 ms; moving spi-current from the 3rd to the 4th dot makes the 4th beat without touching a second copy of the indicator; 7 steps fit in 390 px with 40 px dots.

Chrome 51+✓ Full (measured)
Firefox 55+✓ Full (measured)
Safari 12.1+✓ Measured in the WebKit engine only
Edge 79+✓ Full (Chromium engine)
Safari iOS 12.2+✓ Not checked on a real phone
Chrome Android 51+✓ Full (Chromium engine)

Without JavaScript the state displays correctly, only the beat is missing. Without IntersectionObserver the beat happens on load. With ten steps the row overflows a 390 px screen as long as dots are 40 px: set --spi-dot-size to 24 px.

The code

HTML structure to paste into your page (the CSS + JS come with your purchase):

index.html — structure
<div class="fx-0238-root">
  <ol class="spi-steps" aria-label="Progress">
    <li class="spi-step spi-done"><span class="spi-dot">1</span><span class="spi-sr"> (completed)</span></li>
    <li class="spi-step spi-done"><span class="spi-dot">2</span><span class="spi-sr"> (completed)</span></li>
    <li class="spi-step spi-current" aria-current="step"><span class="spi-dot">3</span><span class="spi-sr"> (in progress)</span></li>
    <li class="spi-step"><span class="spi-dot">4</span></li>
  </ol>
</div>

One-time payment, no subscription — the code is yours forever

Customize

Options passed to the API or data-* attributes:

Option / propertyDefaultEffect
spi-done, spi-current on the li (HTML) steps 1 and 2 passed, 3 current The state. No class: a step to come. Without spi-current, nothing beats (journey finished).
Number of li (HTML) 4 One dot per item; what goes in .spi-dot is up to you (digit, letter, tick).
--spi-active, --spi-done, --spi-idle (CSS) #6366f1, #10b981, 20% indigo Background of the current dot, of passed dots (and travelled lines), of dots and lines to come.
--spi-text (CSS) #a1a1aa Number colour of the steps to come; the other numbers are white.
--spi-dot-size (CSS) 40px Dot diameter. The number size does not follow: set font-size on the root (0 to hide it).
--spi-line-max (CSS) 60px Length of a line when room is not short.
--spi-bg, --spi-min-height (CSS) #0a0a0f, 300px Background and minimum height of the block around the row; transparent and 0 inside a bar or a table row.

FAQ

Progress Steps carries a caption under each dot, fills its line with a gradient and is driven by a single attribute, data-current, which a script turns into classes. Here it is the other way round: no caption, no animated line, and the state is written straight into the HTML. Choose this one when the page leaves the server with the step already known, or when space is tight; the other when you want a captioned journey that animates end to end.
On the step being left: remove spi-current and aria-current, add spi-done, write “(completed)” in its .spi-sr. On the new one: add spi-current, aria-current="step" and “(in progress)”. The beat starts by itself, with no function to call.
The effect has no provision for it. Two routes: print the names in your page under the row, on a grid where each column equals one dot plus one line (third example), or take the twin effect, which shows them out of the box.