Component Library

← Back to gallery

Inbox cleared empty state in HTML, CSS and vanilla JS

A copy-paste Inbox cleared empty state in plain HTML and CSS, with vanilla JavaScript: no framework, no build step, MIT-licensed.

Category: Feedback · Tags: empty-state, inbox, completed, archive

Live preview

Source (copy-ready)

<section class="dcl-empty-cleared-inbox" data-dcl-scheme="light" aria-label="Inbox cleared empty state example">
<div data-stack>
  <div data-row><span data-chip aria-hidden="true">✓</span><h2>You're caught up</h2></div>
  <p>New team updates will appear here. Your earlier messages are still available.</p>
  <details data-well><summary>Browse recently archived messages</summary>
    <ul><li>Field notes are ready</li><li>New visitor handbook</li></ul>
  </details>
</div>
<script>
(() => {
  const root = document.currentScript.closest(".dcl-empty-cleared-inbox");
  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-empty-cleared-inbox, .dcl-empty-cleared-inbox * { box-sizing: border-box; }
.dcl-empty-cleared-inbox { 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-empty-cleared-inbox :where(h2, h3, p, ol, ul, dl, dd) { margin: 0; }
.dcl-empty-cleared-inbox h2 { font-size: 1.25rem; line-height: 1.25; }
.dcl-empty-cleared-inbox h3 { font-size: 1rem; }
.dcl-empty-cleared-inbox p + p { margin-block-start: 0.5rem; }
.dcl-empty-cleared-inbox [data-stack], .dcl-empty-cleared-inbox form { display: grid; gap: 0.75rem; }
.dcl-empty-cleared-inbox [data-row] { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.dcl-empty-cleared-inbox [data-split] { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); gap: 0.75rem 1.25rem; align-items: start; }
.dcl-empty-cleared-inbox [data-spread] { justify-content: space-between; }
.dcl-empty-cleared-inbox [hidden] { display: none !important; }
.dcl-empty-cleared-inbox [data-well] { padding: 0.75rem; border-radius: 0.375rem; }
.dcl-empty-cleared-inbox [data-chip] { display: inline-block; width: fit-content; padding: 0.125rem 0.55rem; border-radius: 99rem; font-size: 0.875rem; font-weight: 700; }
.dcl-empty-cleared-inbox :where(button, summary, input, select) { font: inherit; }
.dcl-empty-cleared-inbox :where(button, input, select) { min-block-size: 44px; min-inline-size: 0; max-inline-size: 100%; }
.dcl-empty-cleared-inbox :where(button, input, select) { border: 1px solid; border-radius: 0.375rem; padding: 0.45rem 0.7rem; }
.dcl-empty-cleared-inbox :where(button, summary) { cursor: pointer; font-weight: 650; }
.dcl-empty-cleared-inbox :where(button, summary):active { box-shadow: inset 0 0 0 2px currentColor; }
.dcl-empty-cleared-inbox summary:hover { text-decoration: underline; }
.dcl-empty-cleared-inbox :where(button, input, select):disabled, .dcl-empty-cleared-inbox [aria-disabled=true] { cursor: not-allowed; border-style: dashed; }
.dcl-empty-cleared-inbox label { display: grid; gap: 0.25rem; }
.dcl-empty-cleared-inbox :where(input, select) { inline-size: 100%; }
.dcl-empty-cleared-inbox label[data-choice] { display: flex; gap: 0.5rem; align-items: center; min-block-size: 44px; }
.dcl-empty-cleared-inbox label[data-choice] input { inline-size: 1.25rem; block-size: 1.25rem; min-block-size: 0; flex-shrink: 0; }
.dcl-empty-cleared-inbox fieldset { min-inline-size: 0; margin: 0; border-radius: 0.375rem; padding: 0.5rem 0.75rem; }
.dcl-empty-cleared-inbox :focus-visible { outline: 3px solid #005c62; outline-offset: 2px; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] :focus-visible { outline: 3px solid #8fe1da; outline-offset: 2px; }
.dcl-empty-cleared-inbox ul { padding-inline-start: 1.5rem; }
.dcl-empty-cleared-inbox { color-scheme: light; border-color: #697f84; }
.dcl-empty-cleared-inbox { color: #11292f; background-color: #ffffff; }
.dcl-empty-cleared-inbox [data-well], .dcl-empty-cleared-inbox [data-chip] { color: #11292f; background-color: #e4edef; }
.dcl-empty-cleared-inbox button, .dcl-empty-cleared-inbox input, .dcl-empty-cleared-inbox select { color: #11292f; background-color: #e4edef; }
.dcl-empty-cleared-inbox button[data-primary] { color: #ffffff; background-color: #00535a; }
.dcl-empty-cleared-inbox button:hover { color: #ffffff; background-color: #003c42; }
.dcl-empty-cleared-inbox button[disabled], .dcl-empty-cleared-inbox button[aria-disabled=true] { color: #405a60; background-color: #e4edef; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] { color-scheme: dark; border-color: #839fa5; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] { color: #eff8f9; background-color: #142f36; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] [data-well], .dcl-empty-cleared-inbox[data-dcl-scheme="dark"] [data-chip] { color: #eff8f9; background-color: #1c3c44; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] button, .dcl-empty-cleared-inbox[data-dcl-scheme="dark"] input, .dcl-empty-cleared-inbox[data-dcl-scheme="dark"] select { color: #eff8f9; background-color: #1c3c44; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] button[data-primary] { color: #11292f; background-color: #8fe1da; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] button:hover { color: #11292f; background-color: #b2f2ec; }
.dcl-empty-cleared-inbox[data-dcl-scheme="dark"] button[disabled], .dcl-empty-cleared-inbox[data-dcl-scheme="dark"] button[aria-disabled=true] { color: #b0c9ce; background-color: #1c3c44; }
</style>

When to use

Use an affirmative empty state after the member finishes reading all messages. Keep past work discoverable.

Avoid

Do not say the inbox is clear if unread items were hidden by a filter.

Accessibility

The title identifies the completed state. Native details lets keyboard users open archived items without leaving the inbox. Text contrast is at least 6.1:1 in light and 6.7:1 in dark.

Was this useful? Send feedback.