Component Library

← Back to gallery

Manual review tabs in HTML, CSS and vanilla JS

A copy-paste Manual review tabs in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.

Category: Navigation · Tags: tabs, manual activation, review, tablist

Live preview

Source (copy-ready)

<section class="dcl-manual-review-tabs" data-dcl-scheme="light" aria-labelledby="dcl-manual-review-tabs-title"><header class="dcl-manual-review-tabs__header"><h2 id="dcl-manual-review-tabs-title">Manual review tabs</h2><p class="dcl-manual-review-tabs__muted">Focus first, then explicitly activate a review stage.</p></header><div class="dcl-manual-review-tabs__tabs" role="tablist" aria-label="Example topics"><button type="button" role="tab" id="dcl-manual-review-tabs-tab-0" aria-controls="dcl-manual-review-tabs-panel-0" aria-selected="true" tabindex="0">Draft</button><button type="button" role="tab" id="dcl-manual-review-tabs-tab-1" aria-controls="dcl-manual-review-tabs-panel-1" aria-selected="false" tabindex="-1">Legal</button><button type="button" role="tab" id="dcl-manual-review-tabs-tab-2" aria-controls="dcl-manual-review-tabs-panel-2" aria-selected="false" tabindex="-1">Release</button></div><div class="dcl-manual-review-tabs__panels"><section role="tabpanel" id="dcl-manual-review-tabs-panel-0" aria-labelledby="dcl-manual-review-tabs-tab-0"><p>Draft copy is visible only to editors.</p></section><section role="tabpanel" id="dcl-manual-review-tabs-panel-1" aria-labelledby="dcl-manual-review-tabs-tab-1" hidden><p>Legal review records the exact approved wording.</p></section><section role="tabpanel" id="dcl-manual-review-tabs-panel-2" aria-labelledby="dcl-manual-review-tabs-tab-2" hidden><p>Release readiness combines owner approval and validation.</p></section></div><p class="dcl-manual-review-tabs__muted" role="status" aria-live="polite" data-note>Arrow keys move focus; Enter activates the focused tab.</p><script>(()=>{const root=document.currentScript.closest(".dcl-manual-review-tabs");if(!root||root.dataset.dclBound)return;root.dataset.dclBound="1";const instance=Array.from(document.getElementsByClassName("dcl-manual-review-tabs")).indexOf(root);if(instance>0){for(const el of [root,...root.querySelectorAll("*")]){for(const attr of ["id","aria-labelledby","aria-controls","aria-describedby","for","name"]){if(el.hasAttribute(attr))el.setAttribute(attr,el.getAttribute(attr)+"--"+instance)}const href=el.getAttribute("href");if(href&&href.startsWith("#"))el.setAttribute("href",href+"--"+instance)}}const preference=matchMedia("(prefers-color-scheme: dark)"),apply=()=>{root.dataset.dclScheme=preference.matches?"dark":"light"};preference.addEventListener("change",apply);apply();const q=(s)=>root.querySelector(s),qa=(s)=>Array.from(root.querySelectorAll(s));const tabs=qa('[role="tab"]');qa('[role="tabpanel"]').forEach(p=>p.tabIndex=0);function activate(tab){tabs.forEach(t=>{const on=t===tab;t.setAttribute("aria-selected",on);t.tabIndex=on?0:-1;document.getElementById(t.getAttribute("aria-controls")).hidden=!on});const n=q("[data-note]");if(n)n.textContent=tab.textContent.trim()+" panel active"}tabs.forEach((t,i)=>{t.addEventListener("click",()=>activate(t));t.addEventListener("keydown",e=>{let n;if(e.key==="ArrowRight")n=(i+1)%tabs.length;else if(e.key==="ArrowLeft")n=(i+tabs.length-1)%tabs.length;else if(e.key==="Enter"||e.key===" "){e.preventDefault();activate(t);return}else return;e.preventDefault();tabs[n].focus()})});})();</script></section>
<style>
.dcl-manual-review-tabs{color:#11292f;background-color:#ffffff;color-scheme:light;font:1rem/1.45 system-ui,sans-serif;padding:.8rem;border:1px solid #697f84;border-radius:.6rem;overflow-wrap:anywhere}
.dcl-manual-review-tabs *{box-sizing:border-box}.dcl-manual-review-tabs h2,.dcl-manual-review-tabs h3{line-height:1.15;margin-block:0 .6rem}.dcl-manual-review-tabs a{color:#005c62}
.dcl-manual-review-tabs button,.dcl-manual-review-tabs input,.dcl-manual-review-tabs select,.dcl-manual-review-tabs textarea,.dcl-manual-review-tabs summary{min-block-size:44px;border:1px solid #697f84;border-radius:.3rem;padding:.4rem .65rem;font:inherit;color:#11292f;background-color:#e4edef}
.dcl-manual-review-tabs input,.dcl-manual-review-tabs select,.dcl-manual-review-tabs textarea{background-color:#ffffff}.dcl-manual-review-tabs input[type="radio"],.dcl-manual-review-tabs input[type="checkbox"]{min-block-size:auto;inline-size:auto}
.dcl-manual-review-tabs button,.dcl-manual-review-tabs summary{cursor:pointer}.dcl-manual-review-tabs button:hover,.dcl-manual-review-tabs summary:hover{color:#ffffff;background-color:#00535a}
.dcl-manual-review-tabs button:focus-visible,.dcl-manual-review-tabs input:focus-visible,.dcl-manual-review-tabs select:focus-visible,.dcl-manual-review-tabs textarea:focus-visible,.dcl-manual-review-tabs summary:focus-visible,.dcl-manual-review-tabs a:focus-visible{outline:3px solid #005c62;outline-offset:2px}
.dcl-manual-review-tabs details{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.4rem;margin-block-start:.6rem}.dcl-manual-review-tabs summary{font-weight:650}
.dcl-manual-review-tabs dialog{color:#11292f;background-color:#ffffff;border:1px solid #697f84;border-radius:.6rem;max-inline-size:min(34rem,92vw);padding:1rem}
.dcl-manual-review-tabs table{border-collapse:collapse;inline-size:100%;color:#11292f;background-color:#ffffff}.dcl-manual-review-tabs th,.dcl-manual-review-tabs td{padding:.4rem;text-align:start;border-block-end:1px solid #697f84}.dcl-manual-review-tabs th{color:#11292f;background-color:#e4edef}
.dcl-manual-review-tabs [hidden]{display:none!important}.dcl-manual-review-tabs__muted{color:#405a60}.dcl-manual-review-tabs__panel{color:#405a60;background-color:#ffffff}.dcl-manual-review-tabs__well{color:#11292f;background-color:#e4edef}.dcl-manual-review-tabs__primary,.dcl-manual-review-tabs__badge{color:#ffffff;background-color:#00535a}.dcl-manual-review-tabs__badge{border-radius:999px;padding:.1rem .45rem;font-size:.8rem;font-weight:700}
.dcl-manual-review-tabs[data-dcl-scheme="dark"]{color:#eff8f9;background-color:#142f36;color-scheme:dark;border-color:#839fa5}.dcl-manual-review-tabs[data-dcl-scheme="dark"] a{color:#8fe1da}
.dcl-manual-review-tabs[data-dcl-scheme="dark"] button,.dcl-manual-review-tabs[data-dcl-scheme="dark"] input,.dcl-manual-review-tabs[data-dcl-scheme="dark"] select,.dcl-manual-review-tabs[data-dcl-scheme="dark"] textarea,.dcl-manual-review-tabs[data-dcl-scheme="dark"] summary{color:#eff8f9;background-color:#1c3c44;border-color:#839fa5}
.dcl-manual-review-tabs[data-dcl-scheme="dark"] input,.dcl-manual-review-tabs[data-dcl-scheme="dark"] select,.dcl-manual-review-tabs[data-dcl-scheme="dark"] textarea{background-color:#142f36}.dcl-manual-review-tabs[data-dcl-scheme="dark"] button:hover,.dcl-manual-review-tabs[data-dcl-scheme="dark"] summary:hover{color:#11292f;background-color:#8fe1da}
.dcl-manual-review-tabs[data-dcl-scheme="dark"] button:focus-visible,.dcl-manual-review-tabs[data-dcl-scheme="dark"] input:focus-visible,.dcl-manual-review-tabs[data-dcl-scheme="dark"] select:focus-visible,.dcl-manual-review-tabs[data-dcl-scheme="dark"] textarea:focus-visible,.dcl-manual-review-tabs[data-dcl-scheme="dark"] summary:focus-visible,.dcl-manual-review-tabs[data-dcl-scheme="dark"] a:focus-visible{outline-color:#8fe1da}
.dcl-manual-review-tabs[data-dcl-scheme="dark"] details,.dcl-manual-review-tabs[data-dcl-scheme="dark"] dialog,.dcl-manual-review-tabs[data-dcl-scheme="dark"] table{color:#eff8f9;background-color:#142f36;border-color:#839fa5}.dcl-manual-review-tabs[data-dcl-scheme="dark"] th{color:#eff8f9;background-color:#1c3c44}.dcl-manual-review-tabs[data-dcl-scheme="dark"] th,.dcl-manual-review-tabs[data-dcl-scheme="dark"] td{border-color:#839fa5}
.dcl-manual-review-tabs[data-dcl-scheme="dark"] .dcl-manual-review-tabs__muted{color:#b0c9ce}.dcl-manual-review-tabs[data-dcl-scheme="dark"] .dcl-manual-review-tabs__panel{color:#b0c9ce;background-color:#142f36}.dcl-manual-review-tabs[data-dcl-scheme="dark"] .dcl-manual-review-tabs__well{color:#eff8f9;background-color:#1c3c44}.dcl-manual-review-tabs[data-dcl-scheme="dark"] .dcl-manual-review-tabs__primary,.dcl-manual-review-tabs[data-dcl-scheme="dark"] .dcl-manual-review-tabs__badge{color:#11292f;background-color:#8fe1da}
@media (prefers-reduced-motion:reduce){.dcl-manual-review-tabs *{transition:none!important;animation:none!important}}
.dcl-manual-review-tabs__tabs{display:flex;flex-wrap:wrap;gap:.4rem;border-block-end:1px solid #697f84;padding-block-end:.5rem}.dcl-manual-review-tabs__panels{padding-block-start:.8rem}</style>

When to use

Use for destructive or costly review workflows where merely crossing a tab must not change the visible context. Keep automatic activation off only when changing panels has a real cost.

Avoid

Do not use manual activation for ordinary lightweight tabs; the extra keypress makes simple browsing slower.

Accessibility

Tabs use manual activation: arrow keys move focus without changing the panel, while Enter or Space activates. The tab list, selected state, controlled panels and roving tabindex follow the tab pattern. Light body text is #405a60 on #ffffff (7.37:1) or #11292f on #e4edef (12.78:1); dark body text is #b0c9ce on #142f36 (8.12:1) or #eff8f9 on #1c3c44 (10.94:1). Focus is shown with a 3px outline.

Was this useful? Send feedback.