Current-step detail strip in HTML, CSS and vanilla JS
A copy-paste Current-step detail strip in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-stepper-expand-current" data-dcl-scheme="light">
<h2>Current-step detail strip</h2>
<ol data-step-list><li>1. Contact · complete</li><li data-card aria-current="step"><h3>2. Delivery · current</h3><p>Choose the depot and pickup window that work for your team.</p></li><li>3. Review · upcoming</li></ol>
<script>
(() => {
const root = document.currentScript.closest('.dcl-stepper-expand-current');
const instance = Array.from(document.getElementsByClassName('dcl-stepper-expand-current')).indexOf(root);
if (instance) {
const suffix = '--' + instance;
const attributes = ['id','aria-labelledby','aria-describedby','aria-controls','for','name','popovertarget'];
for (const element of root.querySelectorAll('*')) {
for (const attr of attributes) {
if (element.hasAttribute(attr)) element.setAttribute(attr, element.getAttribute(attr).split(/\s+/).map(value => value + suffix).join(' '));
}
const href = element.getAttribute('href');
if (href && href.startsWith('#')) element.setAttribute('href', href + suffix);
}
}
const media = matchMedia('(prefers-color-scheme: dark)');
const theme = () => { root.dataset.dclScheme = media.matches ? 'dark' : 'light'; };
media.addEventListener('change', theme);
theme();
})();
</script>
</section>
<style>
.dcl-stepper-expand-current { box-sizing: border-box; max-width: 58rem; padding: clamp(.75rem, 3vw, 1.5rem); border: 1px solid; border-radius: .75rem; font: 1rem/1.5 system-ui,sans-serif; overflow-wrap: anywhere; }
.dcl-stepper-expand-current *, .dcl-stepper-expand-current *::before, .dcl-stepper-expand-current *::after { box-sizing: border-box; }
.dcl-stepper-expand-current h2, .dcl-stepper-expand-current h3, .dcl-stepper-expand-current p, .dcl-stepper-expand-current ul, .dcl-stepper-expand-current ol, .dcl-stepper-expand-current figure { margin: 0; }
.dcl-stepper-expand-current h2 { font-size: 1.25rem; margin-bottom: .875rem; }
.dcl-stepper-expand-current h3 { font-size: 1rem; }
.dcl-stepper-expand-current li + li, .dcl-stepper-expand-current p + p { margin-top: .375rem; }
.dcl-stepper-expand-current ul, .dcl-stepper-expand-current ol { padding-inline-start: 1.35rem; }
.dcl-stepper-expand-current a { text-underline-offset: .18em; }
.dcl-stepper-expand-current a:hover { text-decoration-thickness: .18em; }
.dcl-stepper-expand-current :focus-visible { outline-style: solid; outline-width: 3px; outline-offset: 2px; }
.dcl-stepper-expand-current button, .dcl-stepper-expand-current summary, .dcl-stepper-expand-current input, .dcl-stepper-expand-current select { font: inherit; max-width: 100%; }
.dcl-stepper-expand-current button, .dcl-stepper-expand-current input, .dcl-stepper-expand-current select { padding: .35rem .65rem; border: 1px solid; border-radius: .375rem; }
.dcl-stepper-expand-current button, .dcl-stepper-expand-current summary, .dcl-stepper-expand-current select { cursor: pointer; }
.dcl-stepper-expand-current button:active, .dcl-stepper-expand-current summary:active { box-shadow: inset 0 0 0 2px currentColor; }
.dcl-stepper-expand-current button:disabled, .dcl-stepper-expand-current button[aria-disabled="true"] { cursor: not-allowed; border-style: dashed; }
.dcl-stepper-expand-current [hidden] { display: none !important; }
.dcl-stepper-expand-current [data-line], .dcl-stepper-expand-current [data-actions] { display: flex; gap: .5rem .75rem; align-items: center; flex-wrap: wrap; }
.dcl-stepper-expand-current [data-grid] { display: grid; grid-template-columns: repeat(auto-fit,minmax(min(100%,9rem),1fr)); gap: .75rem; }
.dcl-stepper-expand-current [data-stack], .dcl-stepper-expand-current [data-targets] { display: grid; gap: .75rem; }
.dcl-stepper-expand-current [data-targets] { border-top: 1px solid; padding-top: .75rem; margin-top: .75rem; }
.dcl-stepper-expand-current [data-card], .dcl-stepper-expand-current [data-status], .dcl-stepper-expand-current [data-panel] { padding: .75rem; border: 1px solid; border-radius: .5rem; }
.dcl-stepper-expand-current [data-status] { margin-top: .75rem; }
.dcl-stepper-expand-current [data-status]:empty { border-width: 0; padding: 0; margin: 0; }
.dcl-stepper-expand-current [aria-current] { font-weight: 750; }
.dcl-stepper-expand-current dialog, .dcl-stepper-expand-current [popover] { max-height: calc(100dvh - 2rem); max-width: calc(100% - 2rem); width: min(36rem,100%); border: 1px solid; border-radius: .75rem; padding: 1rem; overflow: auto; }
.dcl-stepper-expand-current dialog h3, .dcl-stepper-expand-current [popover] h3 { margin-bottom: .5rem; }
.dcl-stepper-expand-current dialog [data-actions], .dcl-stepper-expand-current [popover] [data-actions] { margin-top: .75rem; }
.dcl-stepper-expand-current svg { display: block; width: 100%; height: auto; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] { color: #11292f; background-color: #ffffff; border-color: #697f84; color-scheme: light; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] a { color: #005c62; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] button, .dcl-stepper-expand-current[data-dcl-scheme="light"] input, .dcl-stepper-expand-current[data-dcl-scheme="light"] select, .dcl-stepper-expand-current[data-dcl-scheme="light"] summary, .dcl-stepper-expand-current[data-dcl-scheme="light"] [data-card], .dcl-stepper-expand-current[data-dcl-scheme="light"] [data-status], .dcl-stepper-expand-current[data-dcl-scheme="light"] [data-panel] { color: #11292f; background-color: #e4edef; border-color: #697f84; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] button:hover, .dcl-stepper-expand-current[data-dcl-scheme="light"] summary:hover { color: #ffffff; background-color: #00535a; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] dialog, .dcl-stepper-expand-current[data-dcl-scheme="light"] [popover] { color: #11292f; background-color: #ffffff; border-color: #697f84; }
.dcl-stepper-expand-current[data-dcl-scheme="light"] :focus-visible { outline-color: #005c62; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; border-color: #839fa5; color-scheme: dark; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] a { color: #8fe1da; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] button, .dcl-stepper-expand-current[data-dcl-scheme="dark"] input, .dcl-stepper-expand-current[data-dcl-scheme="dark"] select, .dcl-stepper-expand-current[data-dcl-scheme="dark"] summary, .dcl-stepper-expand-current[data-dcl-scheme="dark"] [data-card], .dcl-stepper-expand-current[data-dcl-scheme="dark"] [data-status], .dcl-stepper-expand-current[data-dcl-scheme="dark"] [data-panel] { color: #eff8f9; background-color: #1c3c44; border-color: #839fa5; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] button:hover, .dcl-stepper-expand-current[data-dcl-scheme="dark"] summary:hover { color: #11292f; background-color: #8fe1da; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] dialog, .dcl-stepper-expand-current[data-dcl-scheme="dark"] [popover] { color: #eff8f9; background-color: #142f36; border-color: #839fa5; }
.dcl-stepper-expand-current[data-dcl-scheme="dark"] :focus-visible { outline-color: #8fe1da; }
.dcl-stepper-expand-current [data-step-list] { display: grid; list-style: none; padding: 0; gap: .5rem; }
</style>
When to use
Ordered list expands only the current step's explainer while retaining upcoming step names. Replace the example content and wire the controls or destination IDs to your own screen.
Avoid
Don't hide required instructions for the current step.
Accessibility
Keyboard focus is visibly outlined. Mark it with aria-current="step". The main text contrast is 15.2:1/13.1:1 in light/dark mode, respectively.
Was this useful? Send feedback.