Snippets Admin

Bootstrap 5 Settings Panel with Toggles and Slider

A settings panel with notification switches, a segmented theme picker and a volume slider with a live value. Reset and save buttons are wired up.

Bootstrap 5 No jQuery Jan 2020 2.5K views

<section class="wdw-stage set-preview" id="setPreview">
  <div class="container" style="max-width:980px">
    <form class="wdw-card p-4" id="settingsForm">
      <div class="mb-3">
        <span class="wdw-eyebrow">Preferences</span>
        <h1 class="h3 wdw-heading mt-1 mb-1">Settings</h1>
        <p class="wdw-muted mb-0">Manage notifications, appearance and performance.</p>
      </div>
      <div class="row g-4">
        <div class="col-lg-6">
          <h2 class="wdw-eyebrow mb-2">Notifications</h2>
          <ul class="list-group list-group-flush">
        <li class="list-group-item px-0 d-flex align-items-center gap-3">
          <span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M6 8a6 6 0 1112 0c0 7 3 8 3 8H3s3-1 3-8"/><path d="M10 20a2 2 0 004 0"/></svg></span>
          <label class="flex-grow-1" for="setPush"><span class="d-block fw-semibold">Push notifications</span><span class="d-block small wdw-muted">Alerts on your device</span></label>
          <div class="form-check form-switch fs-4 mb-0"><input class="form-check-input" type="checkbox" role="switch" id="setPush" checked></div>
        </li>
        <li class="list-group-item px-0 d-flex align-items-center gap-3">
          <span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="5" width="18" height="14" rx="2.5"/><path d="M3 7l9 6 9-6"/></svg></span>
          <label class="flex-grow-1" for="setMail"><span class="d-block fw-semibold">Email digest</span><span class="d-block small wdw-muted">A weekly summary every Monday</span></label>
          <div class="form-check form-switch fs-4 mb-0"><input class="form-check-input" type="checkbox" role="switch" id="setMail"></div>
        </li>
        <li class="list-group-item px-0 d-flex align-items-center gap-3">
          <span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M21 12.8A9 9 0 1111.2 3a7 7 0 009.8 9.8z"/></svg></span>
          <label class="flex-grow-1" for="setQuiet"><span class="d-block fw-semibold">Quiet hours</span><span class="d-block small wdw-muted">Mute from 10 pm to 7 am</span></label>
          <div class="form-check form-switch fs-4 mb-0"><input class="form-check-input" type="checkbox" role="switch" id="setQuiet" checked></div>
        </li>
        <li class="list-group-item px-0 d-flex align-items-center gap-3">
          <span class="wdw-icon" aria-hidden="true"><svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M4 7h16M10 11v6M14 11v6M6 7l1 12h10l1-12M9 7V4h6v3"/></svg></span>
          <label class="flex-grow-1" for="setClean"><span class="d-block fw-semibold">Auto-clean old data</span><span class="d-block small wdw-muted">Delete logs older than 30 days</span></label>
          <div class="form-check form-switch fs-4 mb-0"><input class="form-check-input" type="checkbox" role="switch" id="setClean"></div>
        </li>
          </ul>
        </div>
        <div class="col-lg-6">
          <h2 class="wdw-eyebrow mb-2">Appearance</h2>
          <div class="set-seg mb-3" role="radiogroup" aria-label="Theme preview">
            <input type="radio" class="btn-check" name="theme" id="thAuto" value="auto" autocomplete="off" checked><label for="thAuto">Auto</label>
            <input type="radio" class="btn-check" name="theme" id="thLight" value="light" autocomplete="off"><label for="thLight">Light</label>
            <input type="radio" class="btn-check" name="theme" id="thDark" value="dark" autocomplete="off"><label for="thDark">Dark</label>
          </div>
          <h2 class="wdw-eyebrow mb-3">Performance</h2>
      <div class="mb-3">
        <div class="d-flex justify-content-between align-items-baseline mb-1"><label for="setVol" class="fw-semibold">Volume</label><output class="fw-bold text-body-emphasis" for="setVol" id="setVolOut">65%</output></div>
        <input type="range" class="form-range set-range" id="setVol" min="0" max="100" value="65" data-unit="percent" aria-describedby="setVolHelp">
        <div class="small wdw-muted" id="setVolHelp">Alert sound level.</div>
      </div>
      <div class="mb-3">
        <div class="d-flex justify-content-between align-items-baseline mb-1"><label for="setThr" class="fw-semibold">Alert threshold</label><output class="fw-bold text-body-emphasis" for="setThr" id="setThrOut">80%</output></div>
        <input type="range" class="form-range set-range" id="setThr" min="50" max="100" value="80" data-unit="percent" aria-describedby="setThrHelp">
        <div class="small wdw-muted" id="setThrHelp">Notify when usage passes this level.</div>
      </div>
      <div class="mb-3">
        <div class="d-flex justify-content-between align-items-baseline mb-1"><label for="setRef" class="fw-semibold">Refresh interval</label><output class="fw-bold text-body-emphasis" for="setRef" id="setRefOut">15 min</output></div>
        <input type="range" class="form-range set-range" id="setRef" min="1" max="60" value="15" data-unit="minutes" aria-describedby="setRefHelp">
        <div class="small wdw-muted" id="setRefHelp">How often the dashboard polls for new data.</div>
      </div>
        </div>
      </div>
      <div class="d-flex gap-2 justify-content-end pt-3 mt-3 border-top">
        <button type="reset" class="btn btn-outline-primary rounded-pill px-4">Reset</button>
        <button type="submit" class="btn btn-primary rounded-pill px-4">Save changes</button>
      </div>
    </form>
  </div>
  <div class="toast-container position-fixed bottom-0 end-0 p-3">
    <div class="toast align-items-center text-bg-success border-0" id="setToast" role="status" aria-live="polite" aria-atomic="true" data-bs-delay="2500">
      <div class="d-flex"><div class="toast-body">Settings saved.</div><button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button></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.