Snippets Email

Bootstrap 5 Email Inbox with Compose Modal

An email inbox with a folder sidebar, searchable message list with star and select controls, and a compose modal.

Bootstrap 5 No jQuery Oct 2020 2.6K views

<section class="wdw-stage">
  <div class="container" style="max-width: 1100px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <aside class="col-lg-3 border-end p-3 p-lg-4 bg-body-tertiary">
          <div class="d-flex align-items-center gap-3 mb-4">
            <img src="https://i.pravatar.cc/96?img=52" class="rounded-circle" width="48" height="48" alt="">
            <div class="min-w-0"><div class="fw-bold">Jonathan Smith</div><div class="small wdw-muted text-truncate">[email protected]</div></div>
          </div>
          <button type="button" class="btn btn-primary rounded-pill w-100 mb-3" data-bs-toggle="modal" data-bs-target="#ibCompose">
            <svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" 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>
            Compose</button>
          <nav class="nav nav-pills flex-lg-column ib-folders" aria-label="Folders">
            <a class="nav-link active d-flex justify-content-between align-items-center" href="#">Inbox <span class="badge text-bg-light rounded-pill">2</span></a>
            <a class="nav-link" href="#">Sent</a>
            <a class="nav-link" href="#">Important</a>
            <a class="nav-link d-flex justify-content-between align-items-center" href="#">Drafts <span class="badge text-bg-light rounded-pill">30</span></a>
            <a class="nav-link" href="#">Trash</a>
          </nav>
          <div class="d-none d-lg-block mt-4">
            <div class="wdw-eyebrow text-body-secondary mb-2">Labels</div>
            <div class="d-flex flex-wrap gap-2"><span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">Work</span><span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">Design</span><span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">Family</span><span class="badge bg-primary-subtle text-primary-emphasis rounded-pill">Office</span></div>
          </div>
        </aside>
        <div class="col-lg-9">
          <div class="d-flex flex-wrap align-items-center gap-3 p-3 p-lg-4 border-bottom">
            <h2 class="h4 wdw-heading mb-0 me-auto">Inbox</h2>
            <label class="visually-hidden" for="ibSearch">Search mail</label>
            <input type="search" id="ibSearch" class="form-control rounded-pill" style="max-width:260px" placeholder="Search mail">
          </div>
          <div class="d-flex align-items-center gap-2 px-3 px-lg-4 py-2 border-bottom small">
            <input class="form-check-input mt-0" type="checkbox" id="ibAll" aria-label="Select all"><label for="ibAll" class="wdw-muted me-2">All</label>
            <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill">Archive</button>
            <button type="button" class="btn btn-sm btn-outline-secondary rounded-pill">Delete</button>
            <span class="ms-auto wdw-muted d-none d-sm-inline">1-8 of 234</span>
          </div>
          <ul class="list-unstyled mb-0" id="ibList">
        <li class="ib-row is-unread" data-name="arjuna admin quarterly report is ready">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Arjuna Admin">
          <button type="button" class="ib-star is-on" aria-label="Star message" aria-pressed="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=12" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Arjuna Admin</span><span class="ib-subject"><strong>Quarterly report is ready</strong><span class="ib-preview"> - Numbers are final, please review before Friday.</span></span></div>
          <svg class="ib-clip" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-label="Has attachment"><path d="M21 12.5l-8.5 8.5a5.5 5.5 0 0 1-8-7.7l9-9a3.7 3.7 0 0 1 5.2 5.3l-9 9a1.8 1.8 0 0 1-2.6-2.6l8.3-8.3"/></svg>
          <time class="ib-date">9:27 AM</time>
        </li>
        <li class="ib-row is-unread" data-name="john doe hi bro, how are you?">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from John Doe">
          <button type="button" class="ib-star" aria-label="Star message" aria-pressed="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=32" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">John Doe</span><span class="ib-subject"><strong>Hi Bro, how are you?</strong><span class="ib-preview"> - Long time no see. Are you free for a call this week?</span></span></div>
          <span class="ib-clip"></span>
          <time class="ib-date">Mar 15</time>
        </li>
        <li class="ib-row" data-name="jabuk doe design handoff">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Jabuk Doe">
          <button type="button" class="ib-star" aria-label="Star message" aria-pressed="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=5" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Jabuk Doe</span><span class="ib-subject"><strong>Design handoff</strong><span class="ib-preview"> - Attached are the final exports for the landing page.</span></span></div>
          <svg class="ib-clip" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-label="Has attachment"><path d="M21 12.5l-8.5 8.5a5.5 5.5 0 0 1-8-7.7l9-9a3.7 3.7 0 0 1 5.2 5.3l-9 9a1.8 1.8 0 0 1-2.6-2.6l8.3-8.3"/></svg>
          <time class="ib-date">Jun 15</time>
        </li>
        <li class="ib-row" data-name="facebook you have 3 new notifications">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Facebook">
          <button type="button" class="ib-star" aria-label="Star message" aria-pressed="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=3" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Facebook</span><span class="ib-subject"><strong>You have 3 new notifications</strong><span class="ib-preview"> - See what you missed from your friends.</span></span></div>
          <span class="ib-clip"></span>
          <time class="ib-date">Apr 01</time>
        </li>
        <li class="ib-row" data-name="cendy andrianto urgent: contract signature">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Cendy Andrianto">
          <button type="button" class="ib-star is-on" aria-label="Star message" aria-pressed="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=47" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Cendy Andrianto</span><span class="ib-subject"><strong>Urgent: contract signature</strong><span class="ib-preview"> - Please sign and return the contract by tomorrow.</span></span></div>
          <span class="ib-clip"></span>
          <time class="ib-date">May 23</time>
        </li>
        <li class="ib-row" data-name="rosid nur lunch on thursday?">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Rosid Nur">
          <button type="button" class="ib-star is-on" aria-label="Star message" aria-pressed="true"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=64" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Rosid Nur</span><span class="ib-subject"><strong>Lunch on Thursday?</strong><span class="ib-preview"> - There is a new place near the office, want to try it?</span></span></div>
          <svg class="ib-clip" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-label="Has attachment"><path d="M21 12.5l-8.5 8.5a5.5 5.5 0 0 1-8-7.7l9-9a3.7 3.7 0 0 1 5.2 5.3l-9 9a1.8 1.8 0 0 1-2.6-2.6l8.3-8.3"/></svg>
          <time class="ib-date">Jan 19</time>
        </li>
        <li class="ib-row" data-name="fikriandro invoice 2024-118">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Fikriandro">
          <button type="button" class="ib-star" aria-label="Star message" aria-pressed="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=22" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Fikriandro</span><span class="ib-subject"><strong>Invoice 2024-118</strong><span class="ib-preview"> - Your invoice for October is attached.</span></span></div>
          <svg class="ib-clip" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" aria-label="Has attachment"><path d="M21 12.5l-8.5 8.5a5.5 5.5 0 0 1-8-7.7l9-9a3.7 3.7 0 0 1 5.2 5.3l-9 9a1.8 1.8 0 0 1-2.6-2.6l8.3-8.3"/></svg>
          <time class="ib-date">Mar 09</time>
        </li>
        <li class="ib-row" data-name="badrasianto weekly design sync notes">
          <input class="form-check-input ib-check" type="checkbox" aria-label="Select message from Badrasianto">
          <button type="button" class="ib-star" aria-label="Star message" aria-pressed="false"><svg width="18" height="18" viewBox="0 0 24 24" fill="currentColor" aria-hidden="true"><path d="M12 2l3.1 6.3 6.9 1-5 4.9 1.2 6.8L12 17.8 5.8 21l1.2-6.8-5-4.9 6.9-1z"/></svg></button>
          <img class="ib-avatar" src="https://i.pravatar.cc/80?img=70" alt="" width="36" height="36">
          <div class="ib-main"><span class="ib-from">Badrasianto</span><span class="ib-subject"><strong>Weekly design sync notes</strong><span class="ib-preview"> - Summary of what we agreed, plus action items.</span></span></div>
          <span class="ib-clip"></span>
          <time class="ib-date">Feb 25</time>
        </li>
          </ul>
          <p class="text-center wdw-muted p-4 mb-0 d-none" id="ibEmpty">No messages match your search.</p>
        </div>
      </div>
    </div>
  </div>
</section>
<div class="modal fade" id="ibCompose" tabindex="-1" aria-labelledby="ibComposeTitle" aria-hidden="true">
  <div class="modal-dialog modal-dialog-centered"><div class="modal-content border-0 shadow">
    <div class="modal-header border-0"><h3 class="modal-title h5 fw-bold" id="ibComposeTitle">New message</h3><button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button></div>
    <form class="modal-body pt-0" id="ibForm">
      <div class="form-floating mb-3"><input type="email" class="form-control" id="ibTo" placeholder="To" required><label for="ibTo">To</label></div>
      <div class="form-floating mb-3"><input type="text" class="form-control" id="ibSubj" placeholder="Subject"><label for="ibSubj">Subject</label></div>
      <div class="form-floating mb-3"><textarea class="form-control" id="ibBody" placeholder="Message" style="height:150px;min-height:150px"></textarea><label for="ibBody">Message</label></div>
      <div class="d-flex justify-content-end gap-2"><button type="button" class="btn btn-outline-secondary rounded-pill" data-bs-dismiss="modal">Discard</button><button type="submit" class="btn btn-primary rounded-pill px-4">Send</button></div>
    </form>
  </div></div>
</div>

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

Free to use in personal and commercial projects under the MIT license.