Wizard — back keeps your answers
Variant: Back keeps answers
Back on a multi-step form, done so it cannot be mistaken for undo. A plan is picked, Next, a switch flipped, Back, Next again — and both answers are exactly where they were left. Back is the mirror of forward, the same 320ms on the same curve, because a back that is quicker or plainer reads as cancelling. The rail keeps two facts apart. The ring is where you are and moves both ways; the fill is how far you have been and only ever advances, so Back moves the ring and leaves the fill alone. That gives the rail three states — done, visited, ahead — and visited gets its own mark, a clay edge and a clay centre that appears as the ring leaves it: your answers are still in there. Nothing flashes when a panel returns, because a highlight on an unchanged answer suggests it was restored from somewhere. Reach for it on checkout and onboarding, where people go back to check rather than to change. Under reduced motion the panels fade out and then in; the rail behaves exactly the same.
The source
A complete HTML document. Paste it into an empty .html file and it plays — no stylesheet, script, font, or image to fetch.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Wizard — back keeps your answers</title>
<style>
:root {
/* Neutrals — fixed, never remixed. */
--ivory: #faf9f5;
--paper: #ffffff;
--oat: #e3dacc;
--slate: #141413;
/* Knobs — the remix API. A knob exists iff declared here and used below. */
--hue: 38.8;
--lift: 0;
--chroma: 1;
--round: 1;
--speed: 1;
/* Accents — derived from the knobs with the family's offsets baked in,
so one hue roll moves them together. Defaults reproduce the original hex. */
--clay: oklch(calc(0.6724 + var(--lift)) calc(0.1308 * var(--chroma)) var(--hue));
--clay-d: oklch(calc(0.5797 + var(--lift)) calc(0.127 * var(--chroma)) var(--hue));
--olive: oklch(
calc(0.6118 + var(--lift)) calc(0.0713 * var(--chroma)) calc(var(--hue) + 88.3)
);
--rust: oklch(
calc(0.5408 + var(--lift)) calc(0.1357 * var(--chroma)) calc(var(--hue) - 10.3)
);
/* Clock — 6.4s: answer, forward, answer, back, forward again, reset.
1% is 64ms; a press is 1.5% (96ms), a step's travel 5% (320ms). */
--cycle: 6.4s;
--t: calc(var(--cycle) / var(--speed));
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
--_gap: calc(100cqw / 3);
--_off: calc(100% + 16px);
}
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
min-height: 100vh;
display: grid;
place-items: center;
background: var(--ivory);
font-family:
system-ui,
-apple-system,
'Segoe UI',
Roboto,
sans-serif;
color: var(--slate);
}
.frame {
width: clamp(232px, 82vw, 300px);
padding: 14px;
display: grid;
gap: 12px;
border-radius: calc(12px * var(--round));
background: var(--paper);
border: 1px solid color-mix(in srgb, var(--slate) 10%, transparent);
}
.body {
display: grid;
gap: 12px;
animation: reset var(--t) infinite;
}
/* ── The rail ─────────────────────────────────────────────────────── */
.rail {
position: relative;
height: 20px;
margin: 0 10px;
container-type: inline-size;
}
.track,
.fill {
position: absolute;
left: 0;
right: 0;
top: 9px;
height: 2px;
border-radius: 1px;
background: var(--oat);
}
/* Progress is how far you have been, not where you are. Going back moves
the ring; it does not drain the fill. */
.fill {
background: var(--clay);
transform-origin: left center;
transform: scaleX(0.3333);
animation: fill var(--t) infinite;
}
.ring {
position: absolute;
left: -10px;
top: 0;
width: 20px;
height: 20px;
border-radius: 50%;
border: 2px solid var(--clay);
background: var(--paper);
transform: translateX(var(--_gap));
animation: ring var(--t) infinite;
}
.dot {
position: absolute;
left: -6px;
top: 4px;
width: 12px;
height: 12px;
display: grid;
place-items: center;
border-radius: 50%;
background: var(--paper);
border: 2px solid var(--oat);
color: var(--paper);
transform: translateX(calc(var(--_i) * var(--_gap)));
}
.dot svg {
width: 8px;
height: 8px;
}
.d1 {
--_i: 0;
background: var(--clay);
border-color: var(--clay);
}
.d2 {
--_i: 1;
border-color: var(--clay);
animation: done-2 var(--t) infinite;
}
.d2 svg {
opacity: 0;
animation: tick-2 var(--t) infinite;
}
.d3 {
--_i: 2;
animation: visited-3 var(--t) infinite;
}
.d4 {
--_i: 3;
}
/* Visited gets a mark of its own, so it can't be mistaken for "ahead"
(plain) or for "current" (which is the ring, not a dot state). */
.d3::after {
content: '';
width: 4px;
height: 4px;
border-radius: 50%;
background: var(--clay);
transform: scale(0);
animation: visited-mark var(--t) infinite;
}
/* ── The panels ───────────────────────────────────────────────────── */
.stage {
position: relative;
height: 96px;
overflow: hidden;
}
.panel {
position: absolute;
inset: 0;
display: grid;
gap: 7px;
align-content: start;
}
.p2 {
animation: p2 var(--t) infinite;
}
.p3 {
transform: translateX(var(--_off));
animation: p3 var(--t) infinite;
}
.h {
font-size: 13px;
font-weight: 600;
letter-spacing: -0.01em;
margin-bottom: 2px;
}
.opt {
height: 18px;
display: flex;
align-items: center;
gap: 8px;
}
.opt b {
width: 12px;
height: 12px;
flex: none;
display: grid;
place-items: center;
border-radius: 50%;
border: 2px solid var(--oat);
}
.opt b::after {
content: '';
width: 4px;
height: 4px;
border-radius: 50%;
background: var(--clay);
transform: scale(0);
}
.pick {
transform-origin: left center;
animation: tap-pick var(--t) infinite;
}
.pick b {
animation: pick-ring var(--t) infinite;
}
.pick b::after {
animation: pick-dot var(--t) infinite;
}
.opt i,
.row i {
display: block;
height: 6px;
border-radius: 3px;
background: var(--oat);
}
.row {
height: 22px;
display: flex;
align-items: center;
justify-content: space-between;
border-bottom: 1px solid color-mix(in srgb, var(--slate) 7%, transparent);
}
.sw {
width: 22px;
height: 12px;
border-radius: 999px;
background: var(--oat);
position: relative;
}
.sw::after {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 8px;
height: 8px;
border-radius: 50%;
background: var(--paper);
}
.flip {
animation:
sw-bg var(--t) infinite,
tap-flip var(--t) infinite;
}
.flip::after {
animation: sw-knob var(--t) infinite;
}
/* ── Footer ───────────────────────────────────────────────────────── */
.foot {
display: flex;
justify-content: space-between;
align-items: center;
}
.btn {
height: 28px;
padding: 0 14px;
display: grid;
place-items: center;
border-radius: 999px;
font-size: 12px;
font-weight: 600;
}
.back {
color: color-mix(in srgb, var(--slate) 55%, transparent);
animation: press-back var(--t) infinite;
}
.next {
background: var(--clay-d);
color: var(--paper);
animation: press-next var(--t) infinite;
}
/* ── Keyframes ────────────────────────────────────────────────────── */
/* Back is the exact mirror of forward — same 320ms, same curve, panels
trading places in the opposite direction. A back that is quicker or
plainer than forward reads as "undo", and undo is precisely the
thing it must not imply. */
@keyframes p2 {
0%,
14.5% {
transform: translateX(0);
animation-timing-function: var(--ease-in-out);
}
19.5%,
38.5% {
transform: translateX(calc(-1 * var(--_off)));
animation-timing-function: var(--ease-in-out);
}
43.5%,
58.5% {
transform: translateX(0);
animation-timing-function: var(--ease-in-out);
}
63.5%,
85% {
transform: translateX(calc(-1 * var(--_off)));
}
86%,
100% {
transform: translateX(0);
}
}
@keyframes p3 {
0%,
14.5% {
transform: translateX(var(--_off));
animation-timing-function: var(--ease-in-out);
}
19.5%,
38.5% {
transform: translateX(0);
animation-timing-function: var(--ease-in-out);
}
43.5%,
58.5% {
transform: translateX(var(--_off));
animation-timing-function: var(--ease-in-out);
}
63.5%,
85% {
transform: translateX(0);
}
86%,
100% {
transform: translateX(var(--_off));
}
}
@keyframes ring {
0%,
14.5% {
transform: translateX(var(--_gap));
animation-timing-function: var(--ease-in-out);
}
19.5%,
38.5% {
transform: translateX(calc(2 * var(--_gap)));
animation-timing-function: var(--ease-in-out);
}
43.5%,
58.5% {
transform: translateX(var(--_gap));
animation-timing-function: var(--ease-in-out);
}
63.5%,
85% {
transform: translateX(calc(2 * var(--_gap)));
}
86%,
100% {
transform: translateX(var(--_gap));
}
}
/* One forward move, then the fill holds through Back and through the
second Next. It only ever advances; nothing on this screen earns a
reverse. */
@keyframes fill {
0%,
14.5% {
transform: scaleX(0.3333);
animation-timing-function: var(--ease-in-out);
}
19.5%,
85% {
transform: scaleX(0.6667);
}
86%,
100% {
transform: scaleX(0.3333);
}
}
@keyframes done-2 {
0%,
14.5% {
background: var(--paper);
animation-timing-function: ease;
}
16.5%,
85% {
background: var(--clay);
}
86%,
100% {
background: var(--paper);
}
}
@keyframes tick-2 {
0%,
14.5% {
opacity: 0;
transform: scale(0.6);
animation-timing-function: var(--ease-out);
}
17%,
85% {
opacity: 1;
transform: scale(1);
}
86%,
100% {
opacity: 0;
transform: scale(0.6);
}
}
/* Step three turns clay-edged when you first arrive and stays that way
after you leave it: visited, holding answers, not yet done. Three
states on one rail — done, visited, ahead — and back never collapses
the middle one into the last. */
@keyframes visited-3 {
0%,
14.5% {
border-color: var(--oat);
animation-timing-function: ease;
}
16.5%,
85% {
border-color: var(--clay);
}
86%,
100% {
border-color: var(--oat);
}
}
/* The mark appears as the ring leaves the stop — the moment it
becomes a place you were rather than the place you are. */
@keyframes visited-mark {
0%,
38.5% {
transform: scale(0);
animation-timing-function: var(--ease-out);
}
41%,
85% {
transform: scale(1);
}
86%,
100% {
transform: scale(0);
}
}
/* The answers are made once and only once. When each panel comes back
it is simply as it was — no flash, no re-tick — because a highlight on
an unchanged answer suggests it was restored from somewhere, and the
whole point is that it never went anywhere. */
@keyframes pick-ring {
0%,
6% {
border-color: var(--oat);
animation-timing-function: ease;
}
8%,
85% {
border-color: var(--clay);
}
86%,
100% {
border-color: var(--oat);
}
}
@keyframes pick-dot {
0%,
6% {
transform: scale(0);
animation-timing-function: var(--ease-out);
}
8%,
85% {
transform: scale(1);
}
86%,
100% {
transform: scale(0);
}
}
@keyframes tap-pick {
0%,
4.4% {
transform: scale(1);
animation-timing-function: var(--ease-out);
}
6% {
transform: scale(0.97);
animation-timing-function: var(--ease-out);
}
8.5%,
100% {
transform: scale(1);
}
}
@keyframes tap-flip {
0%,
25.4% {
transform: scale(1);
animation-timing-function: var(--ease-out);
}
27% {
transform: scale(0.92);
animation-timing-function: var(--ease-out);
}
29.5%,
100% {
transform: scale(1);
}
}
@keyframes sw-bg {
0%,
27% {
background: var(--oat);
animation-timing-function: ease;
}
29.5%,
85% {
background: var(--olive);
}
86%,
100% {
background: var(--oat);
}
}
@keyframes sw-knob {
0%,
27% {
transform: translateX(0);
animation-timing-function: var(--ease-in-out);
}
29.5%,
85% {
transform: translateX(10px);
}
86%,
100% {
transform: translateX(0);
}
}
@keyframes press-next {
0%,
12.9% {
transform: scale(1);
animation-timing-function: var(--ease-out);
}
14.5% {
transform: scale(0.96);
animation-timing-function: var(--ease-out);
}
17%,
56.9% {
transform: scale(1);
animation-timing-function: var(--ease-out);
}
58.5% {
transform: scale(0.96);
animation-timing-function: var(--ease-out);
}
61%,
100% {
transform: scale(1);
}
}
@keyframes press-back {
0%,
36.9% {
transform: scale(1);
background: transparent;
animation-timing-function: var(--ease-out);
}
38.5% {
transform: scale(0.96);
background: color-mix(in srgb, var(--slate) 6%, transparent);
animation-timing-function: var(--ease-out);
}
41%,
100% {
transform: scale(1);
background: transparent;
}
}
@keyframes reset {
0%,
81% {
opacity: 1;
animation-timing-function: ease;
}
84.5%,
86.5% {
opacity: 0;
animation-timing-function: ease;
}
91%,
100% {
opacity: 1;
}
}
@media (prefers-reduced-motion: reduce) {
/* Panels crossfade in place instead of trading sides, and the cycle
runs 1.5x. The rail keeps everything — the ring's one-gap moves,
the fill that never drains, the visited edge — because that is the
claim, and none of it needs travel to be read. */
.body,
.p2,
.p3,
.ring,
.fill,
.d2,
.d2 svg,
.d3,
.pick,
.pick b,
.pick b::after,
.d3::after,
.flip,
.flip::after,
.back,
.next {
animation-duration: calc(var(--t) * 1.5);
}
.p2 {
animation-name: f2;
}
.p3 {
animation-name: f3;
transform: none;
opacity: 0;
}
/* Out, then in — never both on the same frame. */
@keyframes f2 {
0%,
14.5% {
opacity: 1;
animation-timing-function: ease;
}
16.5%,
40.5% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
43.5%,
58.5% {
opacity: 1;
animation-timing-function: ease;
}
60.5%,
85% {
opacity: 0;
}
86%,
100% {
opacity: 1;
}
}
@keyframes f3 {
0%,
16.5% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
19.5%,
38.5% {
opacity: 1;
animation-timing-function: ease;
}
40.5%,
60.5% {
opacity: 0;
animation-timing-function: var(--ease-out);
}
63.5%,
85% {
opacity: 1;
}
86%,
100% {
opacity: 0;
}
}
}
</style>
</head>
<body>
<div
class="frame"
role="img"
aria-label="A form on step two: a plan is picked, Next moves to step three where a switch is turned on, Back returns to step two with the plan still picked and the progress rail still filled to step three, then Next returns to step three with the switch still on"
>
<div class="body">
<div class="rail" aria-hidden="true">
<span class="track"></span>
<span class="fill"></span>
<span class="ring"></span>
<span class="dot d1"
><svg viewBox="0 0 12 12" fill="none">
<path
d="M2.5 6.2 5 8.5l4.5-5"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/></svg
></span>
<span class="dot d2"
><svg viewBox="0 0 12 12" fill="none">
<path
d="M2.5 6.2 5 8.5l4.5-5"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
/></svg
></span>
<span class="dot d3"></span>
<span class="dot d4"></span>
</div>
<div class="stage">
<div class="panel p2">
<p class="h">Pick a plan</p>
<span class="opt"><b></b><i style="width: 40%"></i></span>
<span class="opt pick"><b></b><i style="width: 54%"></i></span>
<span class="opt"><b></b><i style="width: 34%"></i></span>
</div>
<div class="panel p3">
<p class="h">Notifications</p>
<span class="row"><i style="width: 48%"></i><span class="sw flip"></span></span>
<span class="row"><i style="width: 36%"></i><span class="sw"></span></span>
</div>
</div>
<div class="foot">
<span class="btn back">Back</span>
<span class="btn next">Next</span>
</div>
</div>
</div>
</body>
</html>
The variant family
Same idea, one axis moved. Compare them side by side before you commit.