Ordered checklist with gated steps in HTML, CSS and vanilla JS
A copy-paste Ordered checklist with gated steps in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-ordered-checklist-sequential-unlock-root" aria-label="Ordered checklist with sequential unlock" data-dcl-scheme="light">
<h2>Complete the handoff in sequence</h2><p>Each step unlocks the next.</p><p role="status">0 of 3 steps complete</p><ol class="dcl-ordered-checklist-sequential-unlock-stack" role="list"><li><div class="dcl-ordered-checklist-sequential-unlock-panel"><label class="dcl-ordered-checklist-sequential-unlock-bar"><input type="checkbox" value="0" > 1. Check identifiers</label><p class="dcl-ordered-checklist-sequential-unlock-muted">Confirm that each box has a unique label.</p></div></li>
<li><div class="dcl-ordered-checklist-sequential-unlock-panel"><label class="dcl-ordered-checklist-sequential-unlock-bar"><input type="checkbox" value="1" disabled> 2. Make a working copy</label><p class="dcl-ordered-checklist-sequential-unlock-muted">Keep the original scans unchanged.</p></div></li>
<li><div class="dcl-ordered-checklist-sequential-unlock-panel"><label class="dcl-ordered-checklist-sequential-unlock-bar"><input type="checkbox" value="2" disabled> 3. Record the handoff</label><p class="dcl-ordered-checklist-sequential-unlock-muted">Name the recipient and location.</p></div></li></ol>
<script>
(() => {
const root = document.currentScript.closest(".dcl-ordered-checklist-sequential-unlock-root");
const preference = matchMedia("(prefers-color-scheme: dark)");
const apply = () => {
root.dataset.dclScheme = document.documentElement.dataset.theme || (preference.matches ? "dark" : "light");
};
preference.addEventListener("change", apply);
apply();
const fields = [...root.querySelectorAll("input")];
const announce = () => {
const done = fields.filter((field) => field.checked).length;
root.querySelector('[role="status"]').textContent = done + " of " + fields.length + " steps complete";
const meter = root.querySelector("progress");
if (meter) meter.value = done;
};
root.addEventListener("change", () => {
let unlocked = true;
fields.forEach((field) => {
field.disabled = !unlocked;
if (field.disabled) field.checked = false;
unlocked = field.checked;
});
announce();
});
})();
</script>
</section>
<style>
.dcl-ordered-checklist-sequential-unlock-root { color: #11292f; background-color: #ffffff; color-scheme: light; }
.dcl-ordered-checklist-sequential-unlock-root .dcl-ordered-checklist-sequential-unlock-panel, .dcl-ordered-checklist-sequential-unlock-root .dcl-ordered-checklist-sequential-unlock-badge,
.dcl-ordered-checklist-sequential-unlock-root button, .dcl-ordered-checklist-sequential-unlock-root input, .dcl-ordered-checklist-sequential-unlock-root select, .dcl-ordered-checklist-sequential-unlock-root summary {
color: #11292f; background-color: #e4edef; border-color: #697f84;
}
.dcl-ordered-checklist-sequential-unlock-root .dcl-ordered-checklist-sequential-unlock-muted { color: #405a60; }
.dcl-ordered-checklist-sequential-unlock-root button:hover, .dcl-ordered-checklist-sequential-unlock-root button[aria-pressed="true"], .dcl-ordered-checklist-sequential-unlock-root summary:hover {
color: #ffffff; background-color: #00535a;
}
.dcl-ordered-checklist-sequential-unlock-root a { color: #005c62; }
.dcl-ordered-checklist-sequential-unlock-root :focus-visible { outline: 3px solid #005c62; outline-offset: 3px; }
.dcl-ordered-checklist-sequential-unlock-root { --edge: #697f84; --accent: #00535a; }
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; color-scheme: dark; }
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] .dcl-ordered-checklist-sequential-unlock-panel, .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] .dcl-ordered-checklist-sequential-unlock-badge,
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] button, .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] input, .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] select, .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] summary {
color: #eff8f9; background-color: #1c3c44; border-color: #839fa5;
}
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] .dcl-ordered-checklist-sequential-unlock-muted { color: #b0c9ce; }
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] button:hover, .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] button[aria-pressed="true"], .dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] summary:hover {
color: #11292f; background-color: #8fe1da;
}
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] a { color: #8fe1da; }
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 3px; }
.dcl-ordered-checklist-sequential-unlock-root[data-dcl-scheme="dark"] { --edge: #839fa5; --accent: #8fe1da; }
.dcl-ordered-checklist-sequential-unlock-root { display: grid; gap: 1rem; box-sizing: border-box; max-inline-size: 60rem; margin-inline: auto; padding: clamp(0.875rem, 3vw, 2rem);
border: 1px solid var(--edge); border-radius: 0.75rem; font: 1rem/1.55 system-ui, sans-serif; overflow-wrap: anywhere; }
.dcl-ordered-checklist-sequential-unlock-root * { box-sizing: border-box; min-inline-size: 0; }
.dcl-ordered-checklist-sequential-unlock-root h2, .dcl-ordered-checklist-sequential-unlock-root h3, .dcl-ordered-checklist-sequential-unlock-root p, .dcl-ordered-checklist-sequential-unlock-root ul, .dcl-ordered-checklist-sequential-unlock-root ol, .dcl-ordered-checklist-sequential-unlock-root dl, .dcl-ordered-checklist-sequential-unlock-root dd, .dcl-ordered-checklist-sequential-unlock-root figure, .dcl-ordered-checklist-sequential-unlock-root blockquote, .dcl-ordered-checklist-sequential-unlock-root fieldset { margin: 0; }
.dcl-ordered-checklist-sequential-unlock-root h2 { font-size: clamp(1.375rem, 3vw, 2rem); line-height: 1.18; }
.dcl-ordered-checklist-sequential-unlock-root h3 { font-size: 1.125rem; line-height: 1.3; }
.dcl-ordered-checklist-sequential-unlock-root ul, .dcl-ordered-checklist-sequential-unlock-root ol { padding: 0; list-style: none; }
.dcl-ordered-checklist-sequential-unlock-panel > * + *, .dcl-ordered-checklist-sequential-unlock-disclosure > * + * { margin-block-start: 0.65rem; }
.dcl-ordered-checklist-sequential-unlock-stack, .dcl-ordered-checklist-sequential-unlock-grid, .dcl-ordered-checklist-sequential-unlock-split, .dcl-ordered-checklist-sequential-unlock-rail { display: grid; gap: 1rem; align-items: start; }
.dcl-ordered-checklist-sequential-unlock-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr)); }
.dcl-ordered-checklist-sequential-unlock-split { grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.dcl-ordered-checklist-sequential-unlock-rail { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.dcl-ordered-checklist-sequential-unlock-bar { display: flex; flex-wrap: wrap; gap: 0.625rem; align-items: center; }
.dcl-ordered-checklist-sequential-unlock-spread { justify-content: space-between; }
.dcl-ordered-checklist-sequential-unlock-panel { padding: 1rem; border: 1px solid var(--edge); border-radius: 0.625rem; }
.dcl-ordered-checklist-sequential-unlock-badge { display: inline-block; width: fit-content; border: 1px solid var(--edge); border-radius: 1rem;
padding: 0.16rem 0.65rem; font-size: 0.875rem; font-weight: 650; }
.dcl-ordered-checklist-sequential-unlock-muted { font-size: 0.875rem; }
.dcl-ordered-checklist-sequential-unlock-root button, .dcl-ordered-checklist-sequential-unlock-root input, .dcl-ordered-checklist-sequential-unlock-root select, .dcl-ordered-checklist-sequential-unlock-root summary {
font: inherit; padding: 0.45rem 0.7rem; border: 1px solid; border-radius: 0.375rem; max-inline-size: 100%; }
.dcl-ordered-checklist-sequential-unlock-root input[type="checkbox"], .dcl-ordered-checklist-sequential-unlock-root input[type="radio"] { inline-size: 1.15rem; block-size: 1.15rem; accent-color: var(--accent); }
.dcl-ordered-checklist-sequential-unlock-root button, .dcl-ordered-checklist-sequential-unlock-root select, .dcl-ordered-checklist-sequential-unlock-root summary, .dcl-ordered-checklist-sequential-unlock-root label { cursor: pointer; }
.dcl-ordered-checklist-sequential-unlock-root button:disabled { cursor: not-allowed; border-style: dashed; }
.dcl-ordered-checklist-sequential-unlock-root button:active, .dcl-ordered-checklist-sequential-unlock-root summary:active { text-decoration: underline; }
.dcl-ordered-checklist-sequential-unlock-root a { display: inline-block; padding: 0.2rem; text-underline-offset: 0.2em; }
.dcl-ordered-checklist-sequential-unlock-root a:hover { text-decoration-thickness: 2px; }
.dcl-ordered-checklist-sequential-unlock-root fieldset { padding: 0.75rem; border: 1px solid var(--edge); border-radius: 0.5rem; }
.dcl-ordered-checklist-sequential-unlock-root legend { font-weight: 700; padding-inline: 0.35rem; }
.dcl-ordered-checklist-sequential-unlock-scroll { overflow-x: auto; padding: 0.2rem; }
.dcl-ordered-checklist-sequential-unlock-root table { border-collapse: collapse; inline-size: 100%; text-align: start; }
.dcl-ordered-checklist-sequential-unlock-root caption { text-align: start; font-weight: 700; padding-block: 0.375rem; }
.dcl-ordered-checklist-sequential-unlock-root td, .dcl-ordered-checklist-sequential-unlock-root th { border-block-end: 1px solid var(--edge); padding: 0.5rem; text-align: start; }
.dcl-ordered-checklist-sequential-unlock-root svg { display: block; max-inline-size: 100%; block-size: auto; }
.dcl-ordered-checklist-sequential-unlock-border { border-inline-start: 0.25rem solid var(--accent); padding-inline-start: 0.875rem; }
.dcl-ordered-checklist-sequential-unlock-center { text-align: center; justify-items: center; }
.dcl-ordered-checklist-sequential-unlock-center svg { margin-inline: auto; }
.dcl-ordered-checklist-sequential-unlock-root [hidden] { display: none; }
.dcl-ordered-checklist-sequential-unlock-stack[hidden], .dcl-ordered-checklist-sequential-unlock-bar[hidden] { display: none; }
@media (max-width: 34rem) { .dcl-ordered-checklist-sequential-unlock-rail { grid-template-columns: minmax(0, 1fr); } }
.dcl-ordered-checklist-sequential-unlock-root label:has(input:disabled) { cursor: not-allowed; }
</style>
When to use
Use when a later step truly depends on the previous one. Unchecking a prerequisite clears and locks later steps in this local demo.
Avoid
Do not enforce a sequence on independent work that people could safely complete in parallel.
Accessibility
Native checkboxes are labelled in step order. A polite status reports progress without moving focus. The introductory instruction explains why later steps initially cannot be focused. Theme token text pairs reach at least 6.2:1 in light and 6.8:1 in dark.
Was this useful? Send feedback.