Stage and inspector
The signature: a big grey stage with a step player in the middle and an inspector beside it whose pill switches and fill-bar sliders change the player's fill, outline, pace and number of steps live.
Part of the style
Soft Pill Console
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/soft-pill-console/player/figma.html?type=orange-caps-on-putty
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/soft-pill-console/player/figma.html?type=orange-caps-on-putty and pass that whole HTML document to the html_to_figma tool, so the part "Stage and inspector" 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
<style>
/* Goes after the pack's base.css */
@import url("https://fonts.googleapis.com/css2?family=Antonio:wght@600;700&family=Inter+Tight:wght@400;500;700&display=swap");
:root {
--font-body: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
--font-display: "Antonio", "Arial Narrow", sans-serif;
}
</style>
<section class="player" data-pace="3" data-steps="5">
<div class="player__stage">
<div class="player__corner player__corner--start">
<div class="player__seg" role="radiogroup" aria-label="View">
<span class="player__seg-chip" aria-hidden="true"></span>
<button class="player__seg-option is-on" type="button" role="radio" aria-checked="true" data-view="play">Player</button>
<button class="player__seg-option" type="button" role="radio" aria-checked="false" data-view="list">Steps</button>
</div>
</div>
<div class="player__corner player__corner--end">
<button class="player__round" type="button" aria-label="Save recipe" aria-pressed="false" data-save>
<svg viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"><path d="M6 3.5h8v13l-4-3-4 3z"/></svg>
</button>
<button class="player__round" type="button" aria-label="Start over" data-restart>
<svg viewBox="0 0 20 20" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><path d="M4.5 10a5.5 5.5 0 1 0 1.7-4"/><path d="M4.5 3.5V7H8"/></svg>
</button>
</div>
<div class="player__view player__view--play">
<div class="player__unit">
<div class="player__track" aria-hidden="true"></div>
<button class="player__play" type="button" aria-label="Play">
<svg class="player__icon-play" viewBox="0 0 20 20" width="16" height="16"><path d="M6 4.2v11.6c0 .5.5.8.9.5l9-5.8a.6.6 0 0 0 0-1L6.9 3.7c-.4-.3-.9 0-.9.5z" fill="currentColor"/></svg>
<svg class="player__icon-pause" viewBox="0 0 20 20" width="16" height="16"><rect x="5" y="4" width="3.4" height="12" rx="1" fill="currentColor"/><rect x="11.6" y="4" width="3.4" height="12" rx="1" fill="currentColor"/></svg>
</button>
</div>
<p class="player__now" aria-live="polite"><span class="player__count">Step 1 of 5</span> <span class="player__name">Mix the levain</span></p>
</div>
<ol class="player__view player__view--list player__list" hidden>
<li class="player__item">Mix the levain</li>
<li class="player__item">Rest the dough</li>
<li class="player__item">Stretch and fold</li>
<li class="player__item">Shape the loaf</li>
<li class="player__item">Bake with steam</li>
<li class="player__item">Cool on a rack</li>
<li class="player__item">Slice and share</li>
<li class="player__item">Feed the starter</li>
</ol>
<button class="player__corner-play" type="button" aria-label="Play from the start" data-replay>
<svg viewBox="0 0 20 20" width="14" height="14"><path d="M6 4.2v11.6c0 .5.5.8.9.5l9-5.8a.6.6 0 0 0 0-1L6.9 3.7c-.4-.3-.9 0-.9.5z" fill="currentColor"/></svg>
</button>
</div>
<aside class="player__panel" aria-label="Settings">
<div class="player__head">
<h1 class="player__title">Proof Timer</h1>
<button class="player__round player__round--small" type="button" aria-label="Reset settings" data-reset>
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M5.5 5.5l9 9M14.5 5.5l-9 9"/></svg>
</button>
</div>
<p class="player__lede">Press play and each step of the bake fills as a bar, then hands over to the next dot.</p>
<div class="player__row">
<span class="player__label">Fill</span>
<div class="player__seg player__seg--small" role="radiogroup" aria-label="Fill" data-option="fill">
<span class="player__seg-chip" aria-hidden="true"></span>
<button class="player__seg-option is-on" type="button" role="radio" aria-checked="true" data-value="light">Light</button>
<button class="player__seg-option" type="button" role="radio" aria-checked="false" data-value="dark">Dark</button>
</div>
</div>
<div class="player__row">
<span class="player__label">Outline</span>
<div class="player__seg player__seg--small" role="radiogroup" aria-label="Outline" data-option="outline">
<span class="player__seg-chip" aria-hidden="true"></span>
<button class="player__seg-option is-on" type="button" role="radio" aria-checked="true" data-value="off">Off</button>
<button class="player__seg-option" type="button" role="radio" aria-checked="false" data-value="on">On</button>
</div>
</div>
<div class="player__sliders">
<div class="player__slider" role="slider" tabindex="0" aria-label="Size" aria-valuemin="80" aria-valuemax="140" aria-valuenow="100" data-key="size" data-step="5" data-unit="">
<span class="player__slider-fill"></span>
<span class="player__slider-label">Size</span>
<span class="player__slider-value">100</span>
</div>
<div class="player__slider" role="slider" tabindex="0" aria-label="Pace in seconds" aria-valuemin="1" aria-valuemax="6" aria-valuenow="3" data-key="pace" data-step="0.5" data-unit="s">
<span class="player__slider-fill"></span>
<span class="player__slider-label">Pace</span>
<span class="player__slider-value">3.0s</span>
</div>
<div class="player__slider" role="slider" tabindex="0" aria-label="Steps" aria-valuemin="3" aria-valuemax="8" aria-valuenow="5" data-key="steps" data-step="1" data-unit="">
<span class="player__slider-fill"></span>
<span class="player__slider-label">Steps</span>
<span class="player__slider-value">5</span>
</div>
</div>
<div class="player__actions">
<button class="player__ghost" type="button">
<svg viewBox="0 0 20 20" width="16" height="16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"><path d="M8.5 11.5a3 3 0 0 0 4.2 0l2.6-2.6a3 3 0 0 0-4.2-4.2l-.8.8M11.5 8.5a3 3 0 0 0-4.2 0l-2.6 2.6a3 3 0 0 0 4.2 4.2l.8-.8"/></svg>
Share
</button>
<a class="player__main" href="#">Save to my bakes</a>
</div>
</aside>
</section>
<style>
.player {
--player-scale: 1;
display: grid;
grid-template-columns: minmax(0, 1fr) minmax(280px, 320px);
gap: var(--gap);
max-width: 1280px;
margin: 0 auto;
padding: var(--space-m) var(--edge) var(--section-space);
}
/* Stage */
.player__stage {
position: relative;
display: grid;
place-items: center;
min-height: clamp(420px, 52vw, 720px);
padding: 72px var(--space-l);
border-radius: var(--radius-stage);
background: var(--stage);
}
.player__corner {
position: absolute;
top: var(--space-m);
display: flex;
gap: var(--space-s);
}
.player__corner--start { left: var(--space-m); }
.player__corner--end { right: var(--space-m); }
.player__seg {
position: relative;
display: inline-flex;
padding: var(--space-xs);
border-radius: var(--pill);
background: var(--well);
}
.player__seg-chip {
position: absolute;
top: var(--space-xs);
left: 0;
width: 0;
height: calc(100% - 2 * var(--space-xs));
border-radius: var(--pill);
background: var(--chip);
box-shadow: var(--shadow-chip);
transition: transform var(--time) var(--spring), width var(--time) var(--spring);
}
.player__seg-option {
position: relative;
min-width: 44px;
min-height: var(--control-h);
padding: 0 var(--space-m);
border: 0;
border-radius: var(--pill);
background: none;
color: var(--ink-mute);
font: inherit;
font-size: var(--text-m);
cursor: pointer;
transition: color var(--quick) var(--ease);
}
.player__seg-option:hover { color: var(--ink); }
.player__seg-option.is-on { color: var(--ink); }
.player__seg--small .player__seg-option {
min-height: var(--control-h);
font-size: var(--text-s);
}
.player__round {
display: grid;
place-items: center;
width: var(--control-h);
height: var(--control-h);
padding: 0;
border: 0;
border-radius: var(--pill);
background: var(--well);
color: var(--ink-2);
cursor: pointer;
transition: background var(--quick) var(--ease), scale var(--time) var(--spring-soft);
}
.player__round:hover { background: var(--fill); }
.player__round:active { scale: 0.94; }
.player__round.is-on { background: var(--ink); color: var(--paper); }
.player__view--play {
display: grid;
justify-items: center;
gap: var(--space-l);
}
.player__view[hidden] { display: none; }
.player__unit {
display: flex;
align-items: center;
gap: var(--space-s);
scale: var(--player-scale);
transition: scale var(--time) var(--spring-soft);
}
.player__track {
display: flex;
align-items: center;
gap: var(--space-s);
height: var(--control-h);
padding: 0 var(--space-m);
border-radius: var(--pill);
background: var(--chip);
transition: background var(--time) var(--ease), box-shadow var(--time) var(--ease);
}
.player__dot {
position: relative;
flex: none;
width: var(--dot-size);
height: var(--dot-size);
overflow: hidden;
border-radius: var(--pill);
background: var(--dot);
transition: width var(--time) var(--spring), background var(--quick) var(--ease);
}
.player__dot-fill {
position: absolute;
inset: 0;
border-radius: inherit;
background: var(--ink);
transform: scaleX(0);
transform-origin: left center;
}
.player__dot.is-active { width: var(--dot-active); }
.player__dot.is-done { background: var(--ink); }
.player__dot.is-done .player__dot-fill { transform: scaleX(1); }
.player.is-dark .player__track { background: var(--ink); }
.player.is-dark .player__dot { background: var(--ink-2); }
.player.is-dark .player__dot-fill,
.player.is-dark .player__dot.is-done { background: var(--chip); }
.player.is-dark .player__play { background: var(--ink); color: var(--paper); }
.player.is-outlined .player__track,
.player.is-outlined .player__play { box-shadow: inset 0 0 0 var(--hairline) var(--line); }
.player.is-dark.is-outlined .player__track,
.player.is-dark.is-outlined .player__play { box-shadow: inset 0 0 0 var(--hairline) var(--ink-mute); }
.player__play {
display: grid;
place-items: center;
width: var(--control-h);
height: var(--control-h);
padding: 0;
border: 0;
border-radius: var(--pill);
background: var(--chip);
color: var(--ink);
cursor: pointer;
transition: scale var(--time) var(--spring-soft), background var(--time) var(--ease);
}
.player__play:active { scale: 0.92; }
.player__icon-pause { display: none; }
.player.is-playing .player__icon-play { display: none; }
.player.is-playing .player__icon-pause { display: block; }
.player__now {
margin: 0;
color: var(--ink-mute);
font-size: var(--text-s);
text-align: center;
}
.player__count { color: var(--ink-faint); }
.player__list {
display: grid;
gap: var(--space-xs);
width: min(100%, 320px);
margin: 0;
padding: 0;
list-style: none;
counter-reset: step;
}
.player__item {
display: flex;
align-items: center;
gap: var(--space-m);
min-height: var(--control-h);
padding: 0 var(--space-m);
border-radius: var(--pill);
background: var(--chip);
color: var(--ink-2);
font-size: var(--text-m);
counter-increment: step;
}
.player__item::before {
content: counter(step);
display: grid;
place-items: center;
width: 24px;
height: 24px;
border-radius: var(--pill);
background: var(--well);
color: var(--ink-mute);
font-size: var(--text-xs);
}
.player__item.is-off { display: none; }
.player__item.is-done::before { background: var(--ink); color: var(--paper); }
.player__corner-play {
position: absolute;
right: var(--space-m);
bottom: var(--space-m);
display: grid;
place-items: center;
width: var(--control-h);
height: var(--control-h);
padding: 0;
border: 0;
border-radius: var(--pill);
background: var(--chip);
color: var(--ink-2);
cursor: pointer;
transition: scale var(--time) var(--spring-soft);
}
.player__corner-play:active { scale: 0.92; }
/* Inspector */
.player__panel {
display: flex;
flex-direction: column;
gap: var(--space-m);
padding: var(--space-l);
padding-top: var(--space-m);
border-radius: var(--radius-stage);
background: var(--stage);
}
.player__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-m);
margin-right: calc(var(--space-s) * -1);
}
.player__title {
margin: 0;
font-size: var(--text-xl);
font-weight: 500;
letter-spacing: -0.01em;
}
.player__round--small { width: var(--control-h); height: var(--control-h); }
.player__lede {
margin: 0 0 var(--space-s);
color: var(--ink-soft);
font-size: var(--text-m);
line-height: 1.5;
}
.player__row {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-m);
}
.player__label {
color: var(--ink-2);
font-size: var(--text-m);
}
.player__sliders {
display: grid;
gap: 10px;
margin-top: var(--space-s);
}
.player__slider {
position: relative;
display: flex;
align-items: center;
justify-content: space-between;
height: var(--control-h);
padding: 0 var(--space-m);
overflow: hidden;
border-radius: var(--radius-s);
background: var(--well);
font-size: var(--text-s);
cursor: ew-resize;
touch-action: none;
user-select: none;
}
.player__slider-fill {
position: absolute;
inset: 0 auto 0 0;
width: 40%;
background: var(--fill);
}
.player__slider-label,
.player__slider-value {
position: relative;
color: var(--ink-2);
}
.player__slider-value {
color: var(--ink);
font-variant-numeric: tabular-nums;
}
.player__slider-fill { transition: filter var(--quick) var(--ease); }
.player__slider:hover .player__slider-fill { filter: brightness(0.95); }
.player__actions {
display: grid;
gap: var(--space-s);
margin-top: auto;
padding-top: var(--space-xl);
}
.player__ghost,
.player__main {
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-s);
min-height: var(--control-h);
border-radius: var(--pill);
font: inherit;
font-size: var(--text-m);
text-decoration: none;
cursor: pointer;
transition: background var(--quick) var(--ease), opacity var(--quick) var(--ease), scale var(--time) var(--spring-soft);
}
.player__ghost {
border: var(--hairline) solid var(--line);
background: transparent;
color: var(--ink-2);
}
.player__ghost:hover { background: var(--well); }
.player__main {
background: var(--ink);
color: var(--paper);
font-weight: 500;
}
.player__main:hover { opacity: 0.86; }
.player__ghost:active,
.player__main:active { scale: 0.97; }
.player button:focus-visible,
.player a:focus-visible,
.player__slider:focus-visible {
outline: 2px solid var(--ink);
outline-offset: 2px;
}
@media (max-width: 48rem) {
.player { grid-template-columns: minmax(0, 1fr); }
.player__stage { min-height: 420px; }
.player__actions { padding-top: var(--space-m); }
}
</style>
<script>
(() => {
const still = window.matchMedia("(prefers-reduced-motion: reduce)");
document.querySelectorAll(".player").forEach((root) => {
const track = root.querySelector(".player__track");
const playButton = root.querySelector(".player__play");
const count = root.querySelector(".player__count");
const name = root.querySelector(".player__name");
const items = [...root.querySelectorAll(".player__item")];
const state = { pace: Number(root.dataset.pace) || 3, steps: Number(root.dataset.steps) || 5, size: 100 };
let dots = [];
let index = 0;
let elapsed = 0;
let last = 0;
let frame = 0;
let playing = false;
let visible = true;
const build = () => {
track.textContent = "";
dots = Array.from({ length: state.steps }, () => {
const dot = document.createElement("span");
dot.className = "player__dot";
const fill = document.createElement("span");
fill.className = "player__dot-fill";
dot.append(fill);
track.append(dot);
return dot;
});
items.forEach((item, i) => item.classList.toggle("is-off", i >= state.steps));
index = 0;
elapsed = 0;
paint();
};
const paint = () => {
dots.forEach((dot, i) => {
dot.classList.toggle("is-done", i < index);
dot.classList.toggle("is-active", i === index);
const progress = i === index ? Math.min(elapsed / state.pace, 1) : i < index ? 1 : 0;
dot.firstChild.style.transform = `scaleX(${still.matches && i === index && playing ? 1 : progress})`;
});
items.forEach((item, i) => item.classList.toggle("is-done", i < index));
const shown = Math.min(index, state.steps - 1);
count.textContent = index >= state.steps ? "Done" : `Step ${shown + 1} of ${state.steps}`;
name.textContent = index >= state.steps ? "Out of the oven" : items[shown].textContent;
};
const tick = (now) => {
frame = 0;
if (!playing || !visible) return;
elapsed += (now - last) / 1000;
last = now;
if (elapsed >= state.pace) {
elapsed = 0;
index += 1;
if (index >= state.steps) {
setPlaying(false);
paint();
return;
}
}
paint();
frame = requestAnimationFrame(tick);
};
const run = () => {
if (frame || !playing || !visible) return;
last = performance.now();
frame = requestAnimationFrame(tick);
};
const setPlaying = (on) => {
playing = on;
root.classList.toggle("is-playing", on);
playButton.setAttribute("aria-label", on ? "Pause" : "Play");
if (on) run();
else if (frame) { cancelAnimationFrame(frame); frame = 0; }
};
playButton.addEventListener("click", () => {
if (!playing && index >= state.steps) { index = 0; elapsed = 0; paint(); }
setPlaying(!playing);
});
const restart = () => { index = 0; elapsed = 0; paint(); };
root.querySelector("[data-restart]").addEventListener("click", () => { restart(); });
root.querySelector("[data-replay]").addEventListener("click", () => { restart(); setPlaying(true); });
const save = root.querySelector("[data-save]");
save.addEventListener("click", () => {
const on = save.getAttribute("aria-pressed") !== "true";
save.setAttribute("aria-pressed", String(on));
save.classList.toggle("is-on", on);
});
new IntersectionObserver((entries) => {
visible = entries[0].isIntersecting;
if (visible) run();
}).observe(root);
/* Segmented controls with a sliding chip */
const segs = [...root.querySelectorAll(".player__seg")];
const place = (seg) => {
const chip = seg.querySelector(".player__seg-chip");
const on = seg.querySelector(".is-on");
if (!on || !on.offsetWidth) return;
chip.style.width = on.offsetWidth + "px";
chip.style.transform = `translateX(${on.offsetLeft}px)`;
};
const choose = (seg, option) => {
seg.querySelectorAll(".player__seg-option").forEach((other) => {
other.classList.toggle("is-on", other === option);
other.setAttribute("aria-checked", String(other === option));
});
place(seg);
const key = seg.dataset.option;
if (key === "fill") root.classList.toggle("is-dark", option.dataset.value === "dark");
if (key === "outline") root.classList.toggle("is-outlined", option.dataset.value === "on");
if (option.dataset.view) {
root.querySelector(".player__view--play").hidden = option.dataset.view !== "play";
root.querySelector(".player__view--list").hidden = option.dataset.view !== "list";
}
};
segs.forEach((seg) => {
seg.querySelectorAll(".player__seg-option").forEach((option) => {
option.addEventListener("click", () => choose(seg, option));
});
place(seg);
if ("ResizeObserver" in window) new ResizeObserver(() => place(seg)).observe(seg);
});
/* Fill-bar sliders */
const sliders = [...root.querySelectorAll(".player__slider")];
const setSlider = (slider, raw) => {
const min = Number(slider.getAttribute("aria-valuemin"));
const max = Number(slider.getAttribute("aria-valuemax"));
const step = Number(slider.dataset.step);
const value = Math.min(max, Math.max(min, Math.round(raw / step) * step));
slider.setAttribute("aria-valuenow", String(value));
slider.querySelector(".player__slider-fill").style.width = `${((value - min) / (max - min)) * 100}%`;
const unit = slider.dataset.unit;
slider.querySelector(".player__slider-value").textContent = unit === "s" ? value.toFixed(1) + unit : String(value);
const key = slider.dataset.key;
if (key === "size") { state.size = value; root.style.setProperty("--player-scale", String(value / 100)); }
if (key === "pace") { state.pace = value; }
if (key === "steps" && value !== state.steps) { state.steps = value; setPlaying(false); build(); }
};
sliders.forEach((slider) => {
const min = Number(slider.getAttribute("aria-valuemin"));
const max = Number(slider.getAttribute("aria-valuemax"));
const step = Number(slider.dataset.step);
const fromPointer = (event) => {
const box = slider.getBoundingClientRect();
const ratio = Math.min(1, Math.max(0, (event.clientX - box.left) / box.width));
setSlider(slider, min + ratio * (max - min));
};
slider.addEventListener("pointerdown", (event) => {
slider.setPointerCapture(event.pointerId);
fromPointer(event);
});
slider.addEventListener("pointermove", (event) => {
if (slider.hasPointerCapture(event.pointerId)) fromPointer(event);
});
slider.addEventListener("keydown", (event) => {
const now = Number(slider.getAttribute("aria-valuenow"));
const moves = { ArrowRight: step, ArrowUp: step, ArrowLeft: -step, ArrowDown: -step };
if (event.key in moves) { event.preventDefault(); setSlider(slider, now + moves[event.key]); }
if (event.key === "Home") { event.preventDefault(); setSlider(slider, min); }
if (event.key === "End") { event.preventDefault(); setSlider(slider, max); }
});
setSlider(slider, Number(slider.getAttribute("aria-valuenow")));
});
root.querySelector("[data-reset]").addEventListener("click", () => {
segs.forEach((seg) => { if (seg.dataset.option) choose(seg, seg.querySelector(".player__seg-option")); });
setSlider(sliders[0], 100);
setSlider(sliders[1], 3);
setSlider(sliders[2], 5);
});
build();
/* A first step is already part-filled, so the still preview shows the bar. */
elapsed = state.pace * 0.45;
paint();
});
})();
</script>