148 × 210 mm210 × 297 mm297 × 420 mm
Pace
React + Tailwind
import { useId } from 'react';
const OPTIONS = [{"value": "walk", "label": "Walk"}, {"value": "jog", "label": "Jog"}, {"value": "run", "label": "Run"}];
const STEPS = [0, 1, 2, 3, 4, 5, 6];
const css = `
.radio-pace { --i: 0; display: grid; justify-items: center; gap: 12px; width: 260px; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) { --i: 0; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) { --i: 1; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) { --i: 2; }
@keyframes radio-pace-step { 0% { opacity: 0; transform: var(--t) scale(0.8); } 8% { opacity: 1; transform: var(--t); } 55% { opacity: 0.35; } 100% { opacity: 0; transform: var(--t); } }
.radio-pace__trail { position: relative; width: 220px; height: 64px; }
.radio-pace__print {
--t: translate(calc(var(--k) * var(--gap)), calc(var(--side) * 9px)) rotate(90deg);
position: absolute;
left: 12px;
top: 26px;
width: 9px;
height: 13px;
border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
background: light-dark(#42454c, #e5e6e9);
opacity: 0;
transform: var(--t);
transition: transform 0.4s;
animation: radio-pace-step var(--dur) linear infinite calc(var(--k) * var(--dur) / 7);
}
.radio-pace__print::after { content: ''; position: absolute; left: 1.5px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) { --gap: 24px; --dur: 2.6s; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) { --gap: 29px; --dur: 1.7s; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) { --gap: 34px; --dur: 1.05s; }
.radio-pace__read { display: grid; color: light-dark(#50535b, #c6c8cd); font-size: 12px; font-variant-numeric: tabular-nums; }
.radio-pace__read > * { grid-area: 1 / 1; text-align: center; opacity: 0; transform: translateY(4px); transition: opacity 0.25s, transform 0.3s; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) .radio-pace__read > :nth-child(1) { opacity: 1; transform: none; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) .radio-pace__read > :nth-child(2) { opacity: 1; transform: none; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) .radio-pace__read > :nth-child(3) { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
.radio-pace__print { animation: none; opacity: 0.7; }
}
.radio-pace__opts { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-pace__opt { position: relative; flex: 1; padding: 7px 10px; border-radius: 8px; color: light-dark(#5f626a, #a7abb2); font-size: 12.5px; font-weight: 500; text-align: center; white-space: nowrap; cursor: pointer; transition: background-color 0.25s, color 0.25s; }
.radio-pace__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-pace__opt:has(input:checked) { background: light-dark(#373a40, #f1f2f3); color: light-dark(#fbfcfd, #121417); }
.radio-pace__opt:has(input:focus-visible) { outline: 2px solid light-dark(#50535b, #c6c8cd); outline-offset: 2px; }
.radio-pace__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }
`;
export function PaceRadio() {
const name = useId();
return (
<>
<style>
{css}
</style>
<div className="radio-pace">
<div className="radio-pace__trail" aria-hidden="true">
{STEPS.map((k) => (
<span key={k} className="radio-pace__print" style={{ '--k': k, '--side': k % 2 ? 1 : -1 } as React.CSSProperties} />
))}
</div>
<span className="radio-pace__read" aria-hidden="true">
<span>Walk, about 5 km/h</span>
<span>Jog, about 9 km/h</span>
<span>Run, about 14 km/h</span>
</span>
<div className="radio-pace__opts" role="radiogroup" aria-label="Pace">
{OPTIONS.map((o, i) => (
<label key={o.value} className="radio-pace__opt">
<input className="radio-pace__input" type="radio" name={name} value={o.value} defaultChecked={i === 0} />
{o.label}
</label>
))}
</div>
</div>
</>
);
}Markup where the component goes, CSS in your stylesheet. No JavaScript.
HTML
<div class="radio-pace">
<div class="radio-pace__trail" aria-hidden="true">
<span class="radio-pace__print" style="--k:0;--side:-1"></span>
<span class="radio-pace__print" style="--k:1;--side:1"></span>
<span class="radio-pace__print" style="--k:2;--side:-1"></span>
<span class="radio-pace__print" style="--k:3;--side:1"></span>
<span class="radio-pace__print" style="--k:4;--side:-1"></span>
<span class="radio-pace__print" style="--k:5;--side:1"></span>
<span class="radio-pace__print" style="--k:6;--side:-1"></span>
</div>
<span class="radio-pace__read" aria-hidden="true">
<span>Walk, about 5 km/h</span>
<span>Jog, about 9 km/h</span>
<span>Run, about 14 km/h</span>
</span>
<div class="radio-pace__opts" role="radiogroup" aria-label="Pace">
<label class="radio-pace__opt"><input class="radio-pace__input" type="radio" name="radio-pace" checked="" value="walk"/>Walk</label>
<label class="radio-pace__opt"><input class="radio-pace__input" type="radio" name="radio-pace" value="jog"/>Jog</label>
<label class="radio-pace__opt"><input class="radio-pace__input" type="radio" name="radio-pace" value="run"/>Run</label>
</div>
</div>CSS
.radio-pace { --i: 0; display: grid; justify-items: center; gap: 12px; width: 260px; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) { --i: 0; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) { --i: 1; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) { --i: 2; }
@keyframes radio-pace-step { 0% { opacity: 0; transform: var(--t) scale(0.8); } 8% { opacity: 1; transform: var(--t); } 55% { opacity: 0.35; } 100% { opacity: 0; transform: var(--t); } }
.radio-pace__trail { position: relative; width: 220px; height: 64px; }
.radio-pace__print {
--t: translate(calc(var(--k) * var(--gap)), calc(var(--side) * 9px)) rotate(90deg);
position: absolute;
left: 12px;
top: 26px;
width: 9px;
height: 13px;
border-radius: 50% 50% 45% 45% / 60% 60% 40% 40%;
background: light-dark(#42454c, #e5e6e9);
opacity: 0;
transform: var(--t);
transition: transform 0.4s;
animation: radio-pace-step var(--dur) linear infinite calc(var(--k) * var(--dur) / 7);
}
.radio-pace__print::after { content: ''; position: absolute; left: 1.5px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: inherit; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) { --gap: 24px; --dur: 2.6s; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) { --gap: 29px; --dur: 1.7s; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) { --gap: 34px; --dur: 1.05s; }
.radio-pace__read { display: grid; color: light-dark(#50535b, #c6c8cd); font-size: 12px; font-variant-numeric: tabular-nums; }
.radio-pace__read > * { grid-area: 1 / 1; text-align: center; opacity: 0; transform: translateY(4px); transition: opacity 0.25s, transform 0.3s; }
.radio-pace:has(.radio-pace__opt:nth-child(1) input:checked) .radio-pace__read > :nth-child(1) { opacity: 1; transform: none; }
.radio-pace:has(.radio-pace__opt:nth-child(2) input:checked) .radio-pace__read > :nth-child(2) { opacity: 1; transform: none; }
.radio-pace:has(.radio-pace__opt:nth-child(3) input:checked) .radio-pace__read > :nth-child(3) { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
.radio-pace__print { animation: none; opacity: 0.7; }
}
.radio-pace__opts { display: flex; gap: 3px; padding: 4px; border-radius: 12px; background: light-dark(#f3f4f7, #1a1c1f); box-shadow: inset 0 0 0 1px light-dark(#dbdde1, #2e3035); }
.radio-pace__opt { position: relative; flex: 1; padding: 7px 10px; border-radius: 8px; color: light-dark(#5f626a, #a7abb2); font-size: 12.5px; font-weight: 500; text-align: center; white-space: nowrap; cursor: pointer; transition: background-color 0.25s, color 0.25s; }
.radio-pace__opt:hover { color: light-dark(#42454c, #e5e6e9); }
.radio-pace__opt:has(input:checked) { background: light-dark(#373a40, #f1f2f3); color: light-dark(#fbfcfd, #121417); }
.radio-pace__opt:has(input:focus-visible) { outline: 2px solid light-dark(#50535b, #c6c8cd); outline-offset: 2px; }
.radio-pace__input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none; }Goal: Create a "Pace" radio.
Visual behavior: A pace picker: choose walk, jog or run and footprints appear along the trail, spaced further apart and coming faster at each pace.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Seven prints alternate sides of the trail; each one's position is built in a --t transform from its index (--k), the stride (--gap) and its side.
- They share one keyframe that stamps them in and fades them, delayed by their index over --dur, so the steps run along the trail; each pace sets its own stride and duration.
- A short readout under the scene cross-fades to the chosen option's line. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the footprints show still.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: neutral only. Black, white and grays, no hues. Use the color values above as written, or my project's closest neutral tokens.
Return a single self-contained component. No dependencies.Goal: Create a "Pace" radio.
Visual behavior: A pace picker: choose walk, jog or run and footprints appear along the trail, spaced further apart and coming faster at each pace.
Technique:
- Real native radios (visually hidden: absolute, 1x1, opacity 0) inside <label>s; the scene is aria-hidden and every state is read from the checked input with :has().
- Seven prints alternate sides of the trail; each one's position is built in a --t transform from its index (--k), the stride (--gap) and its side.
- They share one keyframe that stamps them in and fades them, delayed by their index over --dur, so the steps run along the trail; each pace sets its own stride and duration.
- A short readout under the scene cross-fades to the chosen option's line. Pure CSS, no script.
Accessibility: A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the footprints show still.
My stack: {{USER_STACK}}
My styling: {{USER_STYLING}}
My constraints: {{USER_CONSTRAINTS}}
My colors: use my project's existing color tokens. The color values above are grayscale placeholders. Map each one by its role (surface, text, border, accent, glow) to my theme, and keep their relative lightness so contrast and the effect still read.
Return a single self-contained component. No dependencies.Paste into Claude, ChatGPT or Cursor after filling in {{USER_STACK}}, {{USER_STYLING}} and {{USER_CONSTRAINTS}}. Neutral keeps the greys you see here; Match my project asks the model to map them onto your own colour tokens.
Free to use in any project, commercial included. MIT-0, no attribution required. Licence
About this component
A pace picker: choose walk, jog or run and footprints appear along the trail, spaced further apart and coming faster at each pace.
- Dependencies
- None
- Difficulty
- Intermediate
- Triggers
- click, state change, continuous, delay stagger
- Techniques
- keyframes, css variables, stagger
- Reduced motion
- Respected
- Theme
- Light and dark (follows your page's color-scheme)
A role="radiogroup" with an aria-label around native radio inputs sharing one name, so the arrow keys move the choice and Tab enters the group once; :focus-visible on the input outlines its option. Under prefers-reduced-motion the footprints show still.