Snippets Profile

Bootstrap 5 User Profile with Collapsible Sidebar

A profile layout with a collapsible sidebar holding the avatar, follow button and navigation, beside a timeline where new ideas can be posted.

Bootstrap 5 No jQuery Oct 2020 2.8K views

<section class="wdw-stage">
  <div class="container" style="max-width:1040px">
    <div class="wdw-card overflow-hidden">
      <div class="d-flex flex-column flex-lg-row" id="psWrap">
        <div class="collapse collapse-horizontal show ps-collapse" id="psSide">
        <aside class="ps-side border-bottom">
          <div class="wdw-aurora ps-cover"></div>
          <div class="text-center px-4 pb-4 ps-profile">
            <img src="https://i.pravatar.cc/200?img=15" alt="Clark Rodriguez" width="88" height="88" class="rounded-circle mb-3 ps-ring">
            <h1 class="h5 wdw-heading mb-1">Clark Rodriguez</h1>
            <p class="small wdw-muted mb-3">Product designer</p>
            <div class="d-flex justify-content-center gap-4 mb-3 small">
              <div><div class="fw-bold">128</div><div class="wdw-muted">Posts</div></div>
              <div><div class="fw-bold" id="psFollowers">2.4k</div><div class="wdw-muted">Followers</div></div>
            </div>
            <button type="button" class="btn btn-outline-primary btn-sm rounded-pill px-4" id="psFollow" aria-pressed="false">Follow</button>
          </div>
          <nav class="nav nav-pills flex-column gap-1 px-4 pb-4" aria-label="Profile">
            <a class="nav-link rounded-pill active" href="#" aria-current="page">Overview</a>
            <a class="nav-link rounded-pill" href="#">Account settings</a>
            <a class="nav-link rounded-pill" href="#">Tasks</a>
            <a class="nav-link rounded-pill" href="#">Help</a>
          </nav>
        </aside>
        </div>
        <main class="flex-grow-1 p-4 ps-min-w-0">
          <div class="d-flex align-items-center justify-content-between mb-3">
            <button type="button" class="btn btn-outline-primary btn-sm rounded-pill" id="psToggle" data-bs-toggle="collapse" data-bs-target="#psSide" aria-controls="psSide" aria-expanded="true">Hide menu</button>
            <span class="wdw-eyebrow">Timeline</span>
          </div>
          <form class="d-flex gap-2 mb-4" id="psForm">
            <label for="psIdea" class="visually-hidden">Write an idea</label>
            <input type="text" class="form-control" id="psIdea" placeholder="Write an idea..." autocomplete="off">
            <button type="submit" class="btn btn-primary rounded-pill px-4">Post</button>
          </form>
          <div class="list-group list-group-flush" id="psFeed">
            <article class="list-group-item bg-transparent d-flex gap-3 px-0 py-3">
              <img src="https://i.pravatar.cc/100?img=52" alt="" width="48" height="48" class="rounded-circle flex-shrink-0">
              <div><div class="fw-semibold">Dan Hughes <span class="wdw-muted fw-normal small">· 2h</span></div><p class="mb-2">What if onboarding was a single screen? One input, one button, and the rest learned as people go.</p><div class="d-flex gap-2"><button type="button" class="btn btn-sm btn-light rounded-pill" data-like aria-pressed="false" data-count="12">Like · <span>12</span></button><button type="button" class="btn btn-sm btn-light rounded-pill">Reply</button></div></div>
            </article>
            <article class="list-group-item bg-transparent d-flex gap-3 px-0 py-3">
              <img src="https://i.pravatar.cc/100?img=32" alt="" width="48" height="48" class="rounded-circle flex-shrink-0">
              <div><div class="fw-semibold">Amy Cole <span class="wdw-muted fw-normal small">· 5h</span></div><p class="mb-2">Idea: let design tokens live in one JSON file so the whole team ships the same spacing and colour.</p><div class="d-flex gap-2"><button type="button" class="btn btn-sm btn-light rounded-pill" data-like aria-pressed="false" data-count="8">Like · <span>8</span></button><button type="button" class="btn btn-sm btn-light rounded-pill">Reply</button></div></div>
            </article>
            <article class="list-group-item bg-transparent d-flex gap-3 px-0 py-3">
              <img src="https://i.pravatar.cc/100?img=47" alt="" width="48" height="48" class="rounded-circle flex-shrink-0">
              <div><div class="fw-semibold">Rita Moon <span class="wdw-muted fw-normal small">· 1d</span></div><p class="mb-2">Empty states are free real estate. A short tip and one clear action beat a blank page every time.</p><div class="d-flex gap-2"><button type="button" class="btn btn-sm btn-light rounded-pill" data-like aria-pressed="false" data-count="21">Like · <span>21</span></button><button type="button" class="btn btn-sm btn-light rounded-pill">Reply</button></div></div>
            </article>
          </div>
        </main>
      </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.