Snippets Textarea

Bootstrap 5 Notepad Textarea with Ruled Lines

A notepad-style note form with a title field, a ruled paper textarea with a margin line, a character counter and a create button.

Bootstrap 5 No jQuery Sep 2019 2.2K views

<section class="wdw-stage">
  <div class="container" style="max-width: 680px">
    <div class="text-center mb-4">
      <span class="wdw-eyebrow">Notepad</span>
      <h1 class="wdw-heading h2 mt-1 mb-0">Jot something down</h1>
    </div>
    <div class="wdw-card p-3 p-md-4">
      <form id="np" novalidate>
        <div class="form-floating mb-3">
          <input id="npTitle" name="title" type="text" class="form-control fw-semibold" placeholder="Title" maxlength="60" autocomplete="off">
          <label for="npTitle">Title</label>
        </div>
        <label for="npText" class="visually-hidden">Note</label>
        <textarea id="npText" name="text" class="form-control np-ruled" rows="5" maxlength="280" placeholder="Enter something funny."></textarea>
        <div class="d-flex align-items-center gap-3 mt-3">
          <div class="flex-grow-1">
            <div class="progress" style="height: 6px" role="progressbar" aria-label="Characters used" aria-valuenow="0" aria-valuemin="0" aria-valuemax="280" id="npBarWrap">
              <div class="progress-bar" id="npBar" style="width: 0%"></div>
            </div>
            <small class="wdw-muted d-block mt-1" id="npCount" aria-live="polite">0 / 280</small>
          </div>
          <button type="submit" class="btn btn-primary rounded-pill px-4"><i class="bi bi-check2"></i> Create note</button>
        </div>
      </form>
      <hr class="my-4">
      <div class="d-flex align-items-center justify-content-between mb-2">
        <h2 class="h6 fw-bold mb-0">Saved notes</h2>
        <span class="badge rounded-pill bg-primary-subtle text-primary-emphasis" id="npTotal">1</span>
      </div>
      <ul class="list-unstyled d-grid gap-2 mb-0" id="npList" aria-live="polite">
        <li class="np-note">
          <div class="d-flex align-items-start gap-2">
            <i class="bi bi-pin-angle-fill text-primary mt-1"></i>
            <div class="flex-grow-1"><div class="fw-semibold">Welcome</div><div class="small text-body-secondary">Write a note above and it lands here, newest first.</div></div>
            <span class="small text-body-secondary">Pinned</span>
          </div>
        </li>
      </ul>
    </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.