Approval required alert in HTML, CSS and vanilla JS
A copy-paste Approval required alert in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.
Live preview
Source (copy-ready)
<section class="dcl-alert-approval-steps" data-dcl-scheme="light" aria-label="Approval required alert example">
<div data-split>
<div data-stack><span data-chip>Publish blocked</span><h2>Approval needed for this release</h2><p>You can continue editing before you request approval.</p></div>
<ol data-well><li>Add the rollback instructions.</li><li>Ask a workspace owner to review.</li><li>Publish after approval.</li></ol>
</div>
<script>
(() => {
const root = document.currentScript.closest(".dcl-alert-approval-steps");
const preference = matchMedia("(prefers-color-scheme: dark)");
const setTheme = () => { root.dataset.dclScheme = preference.matches ? "dark" : "light"; };
preference.addEventListener("change", setTheme);
setTheme();
})();
</script>
</section>
<style>
.dcl-alert-approval-steps, .dcl-alert-approval-steps * { box-sizing: border-box; }
.dcl-alert-approval-steps { font: 1rem/1.5 system-ui, sans-serif; max-inline-size: 40rem; padding: clamp(0.75rem, 3vw, 1.25rem); border: 1px solid; border-radius: 0.75rem; overflow-wrap: anywhere; }
.dcl-alert-approval-steps :where(h2, h3, p, ol, ul, dl, dd) { margin: 0; }
.dcl-alert-approval-steps h2 { font-size: 1.25rem; line-height: 1.25; }
.dcl-alert-approval-steps h3 { font-size: 1rem; }
.dcl-alert-approval-steps p + p { margin-block-start: 0.5rem; }
.dcl-alert-approval-steps [data-stack], .dcl-alert-approval-steps form { display: grid; gap: 0.75rem; }
.dcl-alert-approval-steps [data-row] { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.dcl-alert-approval-steps [data-split] { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0.75rem 1.25rem; align-items: start; }
.dcl-alert-approval-steps [data-spread] { justify-content: space-between; }
.dcl-alert-approval-steps [hidden] { display: none !important; }
.dcl-alert-approval-steps [data-well] { padding: 0.75rem; border-radius: 0.375rem; }
.dcl-alert-approval-steps [data-chip] { display: inline-block; width: fit-content; padding: 0.125rem 0.55rem; border-radius: 99rem; font-size: 0.875rem; font-weight: 700; }
.dcl-alert-approval-steps ol[data-well] { padding-inline-start: 2.2rem; }
.dcl-alert-approval-steps { color-scheme: light; border-color: #697f84; }
.dcl-alert-approval-steps { color: #11292f; background-color: #ffffff; }
.dcl-alert-approval-steps [data-well], .dcl-alert-approval-steps [data-chip] { color: #11292f; background-color: #e4edef; }
.dcl-alert-approval-steps[data-dcl-scheme="dark"] { color-scheme: dark; border-color: #839fa5; }
.dcl-alert-approval-steps[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; }
.dcl-alert-approval-steps[data-dcl-scheme="dark"] [data-well], .dcl-alert-approval-steps[data-dcl-scheme="dark"] [data-chip] { color: #eff8f9; background-color: #1c3c44; }
</style>
When to use
Make a release blocker actionable with an ordered list of prerequisites alongside the next step.
Avoid
Do not turn a notice into a block if the reader can safely continue without doing the work.
Accessibility
A heading names the blocker. The ordered list conveys the required sequence without relying on icons. Text contrast is at least 12.7:1 in light and 10.9:1 in dark.
Was this useful? Send feedback.