Snippets Inbox

Bootstrap 5 Responsive Mail Inbox Layout

A responsive mail inbox with a folder sidebar, select-all toolbar, starring and unread highlighting.

Bootstrap 5 No jQuery Apr 2020 2K views

<section class="wdw-stage">
  <div class="container" style="max-width: 62rem;">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <aside class="col-md-4 col-lg-3 p-3 p-lg-4 border-end-md bg-body-tertiary" aria-label="Mail folders">
          <button type="button" class="btn btn-primary rounded-pill w-100 mb-3"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 5v14M5 12h14"/></svg> Compose</button>
          <ul class="nav nav-pills flex-md-column flex-wrap flex-md-nowrap gap-1 wdw-folders" id="mailFolders">
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100 active" data-folder="Inbox" aria-current="page"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M22 12h-6l-2 3h-4l-2-3H2"/><path d="M5.5 5h13L22 12v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z"/></svg><span>Inbox</span><span class="badge rounded-pill text-bg-primary ms-auto">4</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Starred"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg><span>Starred</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Drafts"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M12 20h9"/><path d="M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z"/></svg><span>Drafts</span><span class="badge rounded-pill text-bg-primary ms-auto">2</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Sent"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m22 2-7 20-4-9-9-4z"/><path d="M22 2 11 13"/></svg><span>Sent</span></button></li>
<li class="nav-item"><button type="button" class="nav-link d-flex align-items-center gap-2 w-100" data-folder="Trash"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6"/></svg><span>Trash</span></button></li>
          </ul>
        </aside>
        <div class="col-md-8 col-lg-9">
          <div class="d-flex align-items-center gap-3 px-3 py-3 border-bottom">
            <div class="form-check mb-0"><input class="form-check-input" type="checkbox" id="mailAll" aria-label="Select all messages"></div>
            <h2 class="h6 fw-bold mb-0 me-auto" id="mailTitle">Inbox</h2>
            <span class="small text-body-secondary d-none d-sm-inline" id="mailCount" aria-live="polite">0 selected</span>
            <button type="button" class="btn btn-sm btn-outline-primary rounded-pill" id="mailRead" disabled>Mark as read</button>
          </div>
          <ul class="list-unstyled mb-0 wdw-mail-list" id="mailList">
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m0" aria-label="Select message from Vishvjeet Patel"></div>
  <button type="button" class="wdw-star on" aria-pressed="true" aria-label="Star message from Vishvjeet Patel"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">VP</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Vishvjeet Patel</span><time class="small text-body-secondary flex-shrink-0">Oct 28</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Quarterly roadmap review</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">Two items need your sign-off before Friday: the mobile onboarding rework and the analytics dashboard scope.</p>
  </div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m1" aria-label="Select message from Anjali Sharma"></div>
  <button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Anjali Sharma"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">AS</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Anjali Sharma</span><time class="small text-body-secondary flex-shrink-0">Oct 25</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Design tokens are ready</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">The new spacing and colour tokens are published. Take a look at the scale and tell me what feels off.</p>
  </div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m2" aria-label="Select message from Mary Grace"></div>
  <button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Mary Grace"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">MG</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Mary Grace</span><time class="small text-body-secondary flex-shrink-0">Oct 22</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Invoice #2041 paid</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">Thanks for the quick turnaround. The payment cleared this morning and the receipt is attached for your records.</p>
  </div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3 unread" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m3" aria-label="Select message from Richard Hale"></div>
  <button type="button" class="wdw-star on" aria-pressed="true" aria-label="Star message from Richard Hale"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">RH</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Richard Hale</span><time class="small text-body-secondary flex-shrink-0">Oct 21</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Standup notes, Tuesday</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">Short recap: the checkout fix shipped, the onboarding copy is in review and the analytics migration slips a day.</p>
  </div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m4" aria-label="Select message from Priya Nair"></div>
  <button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Priya Nair"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">PN</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Priya Nair</span><time class="small text-body-secondary flex-shrink-0">Oct 19</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Welcome to the beta</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">You are in. Here is how to invite your team, connect your calendar and get the most from the first week.</p>
  </div>
</li>
<li class="wdw-mail-row d-flex align-items-start gap-3 px-3 py-3" data-row>
  <div class="form-check pt-1"><input class="form-check-input" type="checkbox" id="m5" aria-label="Select message from Tom Becker"></div>
  <button type="button" class="wdw-star" aria-pressed="false" aria-label="Star message from Tom Becker"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.9" stroke-linejoin="round" aria-hidden="true"><path d="m12 3 2.7 5.6 6.1.9-4.4 4.3 1 6.1L12 17l-5.4 2.9 1-6.1L3.2 9.5l6.1-.9z"/></svg></button>
  <span class="wdw-avatar" aria-hidden="true">TB</span>
  <div class="min-w-0 flex-grow-1">
    <div class="d-flex justify-content-between gap-3"><span class="wdw-from text-truncate">Tom Becker</span><time class="small text-body-secondary flex-shrink-0">Oct 17</time></div>
    <p class="wdw-subject mb-0 text-truncate"><button type="button" class="wdw-open">Lunch on Friday?</button></p>
    <p class="small text-body-secondary mb-0 wdw-preview">A few of us are heading to the new place near the station around noon. Let me know if you want a seat.</p>
  </div>
</li>
          </ul>
        </div>
      </div>
    </div>
  </div>
</section>

Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.