Snippets Email

Bootstrap 5 Email Inbox Layout with Sidebar and Search

An email inbox with a folder sidebar, compose button, bulk actions, live search and a message list with unread highlighting, star toggles and pagination.

Bootstrap 5 No jQuery Oct 2020 2.3K views

<section class="wdw-stage">
  <div class="container" style="max-width:1080px">
    <div class="wdw-card overflow-hidden">
      <div class="row g-0">
        <aside class="col-lg-3 p-3 p-lg-4 bg-body-tertiary mail-side">
          <h1 class="h4 wdw-heading d-flex align-items-center gap-2 mb-3"><span class="wdw-icon"><i class="bi bi-inbox" aria-hidden="true"></i></span>Inbox</h1>
          <button type="button" class="btn btn-primary rounded-pill w-100 mb-3"><i class="bi bi-pencil-square" aria-hidden="true"></i>New message</button>
          <div class="mail-folders-wrap"><nav class="nav nav-pills flex-lg-column flex-nowrap mail-folders" aria-label="Folders">
            <a class="nav-link active d-flex align-items-center gap-2" href="#" aria-current="page"><i class="bi bi-inbox" aria-hidden="true"></i>Inbox<span class="badge rounded-pill ms-auto mail-count">14</span></a>
            <a class="nav-link d-flex align-items-center gap-2" href="#"><i class="bi bi-star" aria-hidden="true"></i>Starred</a>
            <a class="nav-link d-flex align-items-center gap-2" href="#"><i class="bi bi-send" aria-hidden="true"></i>Sent</a>
            <a class="nav-link d-flex align-items-center gap-2" href="#"><i class="bi bi-file-earmark" aria-hidden="true"></i>Drafts</a>
            <a class="nav-link d-flex align-items-center gap-2" href="#"><i class="bi bi-exclamation-octagon" aria-hidden="true"></i>Spam<span class="badge rounded-pill ms-auto bg-secondary-subtle text-body-secondary">217</span></a>
          </nav></div>
        </aside>
        <div class="col-lg-9">
          <div class="d-flex flex-wrap align-items-center gap-2 p-3 border-bottom">
            <div class="form-check m-0 ms-1"><input class="form-check-input" type="checkbox" id="mailAll" aria-label="Select all"></div>
            <div class="dropdown">
              <button class="btn btn-outline-secondary btn-sm rounded-pill dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">Action</button>
              <ul class="dropdown-menu">
                <li><button class="dropdown-item" type="button" data-action="read">Mark as read</button></li>
                <li><button class="dropdown-item" type="button" data-action="unread">Mark as unread</button></li>
                <li><hr class="dropdown-divider"></li>
                <li><button class="dropdown-item text-danger" type="button" data-action="delete">Delete</button></li>
              </ul>
            </div>
            <div class="input-group ms-auto mail-search">
              <input type="search" class="form-control" placeholder="Search mail" aria-label="Search mail" id="mailSearch">
              <button class="btn btn-primary" type="button" aria-label="Search"><i class="bi bi-search" aria-hidden="true"></i></button>
            </div>
          </div>
          <ul class="list-unstyled m-0" id="mailList">
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3 unread">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Larry Gardner">
          <button type="button" class="mail-star btn btn-link p-0 on" aria-pressed="true" aria-label="Starred"><i class="bi bi-star-fill" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Larry Gardner</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Q3 roadmap review</span><span class="text-body-secondary"> — Here is the draft deck for Thursday, please add your comments before noon.</span></span>
          </a>
          <span class="badge rounded-pill bg-body-secondary text-body-secondary border d-none d-md-inline-block">Work</span>
          <time class="mail-time small text-body-secondary text-nowrap">08:30</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3 unread">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Priya Nair">
          <button type="button" class="mail-star btn btn-link p-0" aria-pressed="false" aria-label="Starred"><i class="bi bi-star" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Priya Nair</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Design tokens are merged</span><span class="text-body-secondary"> — The new spacing scale landed in main. Components pick it up automatically.</span></span>
          </a>
          <span class="badge rounded-pill bg-body-secondary text-body-secondary border d-none d-md-inline-block">Design</span>
          <time class="mail-time small text-body-secondary text-nowrap">08:12</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Stripe">
          <button type="button" class="mail-star btn btn-link p-0" aria-pressed="false" aria-label="Starred"><i class="bi bi-star" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Stripe</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Your payout is on the way</span><span class="text-body-secondary"> — A payout of $2,480.00 will arrive in your bank account on Friday.</span></span>
          </a>
          <span class="badge rounded-pill bg-body-secondary text-body-secondary border d-none d-md-inline-block">Finance</span>
          <time class="mail-time small text-body-secondary text-nowrap">Yesterday</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Marcus Lee">
          <button type="button" class="mail-star btn btn-link p-0 on" aria-pressed="true" aria-label="Starred"><i class="bi bi-star-fill" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Marcus Lee</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Lunch on Friday?</span><span class="text-body-secondary"> — Found a new ramen place near the office, are you in?</span></span>
          </a>
          
          <time class="mail-time small text-body-secondary text-nowrap">Yesterday</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from GitHub">
          <button type="button" class="mail-star btn btn-link p-0" aria-pressed="false" aria-label="Starred"><i class="bi bi-star" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">GitHub</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">[ui-kit] Pull request approved</span><span class="text-body-secondary"> — Alex approved your changes in #482 Refactor card component.</span></span>
          </a>
          <span class="badge rounded-pill bg-body-secondary text-body-secondary border d-none d-md-inline-block">Work</span>
          <time class="mail-time small text-body-secondary text-nowrap">Mon</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Elena Rossi">
          <button type="button" class="mail-star btn btn-link p-0" aria-pressed="false" aria-label="Starred"><i class="bi bi-star" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Elena Rossi</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Invoice 0042</span><span class="text-body-secondary"> — Attached is the invoice for September. Let me know if anything is off.</span></span>
          </a>
          <span class="badge rounded-pill bg-body-secondary text-body-secondary border d-none d-md-inline-block">Finance</span>
          <time class="mail-time small text-body-secondary text-nowrap">Mon</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Tom Becker">
          <button type="button" class="mail-star btn btn-link p-0 on" aria-pressed="true" aria-label="Starred"><i class="bi bi-star-fill" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Tom Becker</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Weekend hike photos</span><span class="text-body-secondary"> — Uploaded everything to the shared album, the sunrise ones are great.</span></span>
          </a>
          
          <time class="mail-time small text-body-secondary text-nowrap">Sun</time>
        </li>
        <li class="mail-row d-flex align-items-center gap-2 gap-md-3 px-3 py-3">
          <input class="form-check-input mail-check m-0" type="checkbox" aria-label="Select message from Calendar">
          <button type="button" class="mail-star btn btn-link p-0" aria-pressed="false" aria-label="Starred"><i class="bi bi-star" aria-hidden="true"></i></button>
          <a href="#" class="mail-link d-flex flex-column flex-md-row align-items-md-center gap-md-3 flex-grow-1 text-decoration-none">
            <span class="mail-from text-truncate">Calendar</span>
            <span class="text-truncate flex-grow-1"><span class="mail-subject">Reminder: Team offsite</span><span class="text-body-secondary"> — Tomorrow 10:00 at the Riverside Hub. Bring a laptop and good shoes.</span></span>
          </a>
          
          <time class="mail-time small text-body-secondary text-nowrap">Sat</time>
        </li>
            <li class="d-none text-center text-body-secondary py-5 px-3" id="mailEmpty"><i class="bi bi-search fs-3 d-block mb-2" aria-hidden="true"></i>No messages match your search.</li>
          </ul>
          <div class="d-flex align-items-center justify-content-between p-3 border-top">
            <span class="small text-body-secondary">1–8 of 241</span>
            <nav aria-label="Pages"><ul class="pagination pagination-sm m-0">
              <li class="page-item disabled"><a class="page-link rounded-start-pill" href="#" aria-label="Previous" aria-disabled="true" tabindex="-1">«</a></li>
              <li class="page-item active"><a class="page-link" href="#">1</a></li><li class="page-item"><a class="page-link" href="#">2</a></li><li class="page-item"><a class="page-link" href="#">3</a></li>
              <li class="page-item"><a class="page-link rounded-end-pill" href="#" aria-label="Next">»</a></li>
            </ul></nav>
          </div>
        </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.

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