Snippets List

Bootstrap 5 Todo List with Filters and Progress Bar

A todo list with add, complete and delete actions, an open/done filter and a progress bar that tracks finished tasks.

Bootstrap 5 No jQuery Dec 2019 5.8K views

<section class="wdw-stage">
  <div class="container" style="max-width: 680px">
    <div class="wdw-card p-4 p-md-5">
      <div class="d-flex justify-content-between align-items-end mb-4">
        <div>
          <span class="wdw-eyebrow">Today</span>
          <h2 class="wdw-heading h3 mt-1 mb-0">Todo list</h2>
        </div>
        <span class="badge rounded-pill bg-primary-subtle px-3 py-2 text-primary-emphasis" id="tdCount" aria-live="polite">0 left</span>
      </div>

      <div class="progress mb-4" style="height: 6px" role="progressbar" aria-label="Completed tasks" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0" id="tdBar"><div class="progress-bar" style="width:0"></div></div>

      <form class="d-flex gap-2 mb-3" id="tdForm">
        <label for="tdInput" class="visually-hidden">New task</label>
        <input type="text" class="form-control rounded-pill ps-4" id="tdInput" placeholder="Add a task for today" autocomplete="off">
        <button class="btn btn-primary rounded-pill px-4" type="submit">Add</button>
      </form>

      <ul class="nav nav-pills gap-1 mb-3" id="tdFilter" aria-label="Filter tasks">
        <li class="nav-item"><button type="button" class="nav-link rounded-pill active " data-filter="all">All <span class="td-n" data-n="all">0</span></button></li>
        <li class="nav-item"><button type="button" class="nav-link rounded-pill " data-filter="open">Open <span class="td-n" data-n="open">0</span></button></li>
        <li class="nav-item"><button type="button" class="nav-link rounded-pill " data-filter="done">Done <span class="td-n" data-n="done">0</span></button></li>
      </ul>

      <ul class="list-group list-group-flush td-list" id="tdList"></ul>
      <div class="text-center wdw-muted py-4 d-none" id="tdEmpty"><span class="wdw-icon d-inline-grid mb-2" style="width:48px;height:48px"><svg viewBox="0 0 24 24" width="24" height="24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="9"/><path d="m8 12.5 3 3 5-6"/></svg></span><p class="mb-0">Nothing here. Enjoy the quiet.</p></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.