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.
<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>
/* Web Designer Wall library style — shared base for every Bootstrap 5 snippet.
Indigo accent, Plus Jakarta Sans, soft cards, pill buttons. Works in light and dark. */
@import url("https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap");
:root,
[data-bs-theme="light"] {
--wdw-font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
--bs-body-font-family: var(--wdw-font);
--bs-primary: #4f46e5;
--bs-primary-rgb: 79, 70, 229;
--bs-primary-text-emphasis: #3730a3;
--bs-primary-bg-subtle: #eef2ff;
--bs-primary-border-subtle: #c7d2fe;
--bs-link-color: #4f46e5;
--bs-link-color-rgb: 79, 70, 229;
--bs-link-hover-color: #4338ca;
--bs-link-hover-color-rgb: 67, 56, 202;
--bs-focus-ring-color: rgba(79, 70, 229, 0.25);
--bs-border-radius: 0.75rem;
--bs-border-radius-lg: 1rem;
--bs-border-radius-xl: 1.25rem;
--wdw-radius-card: 1.25rem;
--wdw-shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 16px 40px -16px rgba(16, 24, 40, 0.22);
--wdw-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 4px 12px -4px rgba(16, 24, 40, 0.12);
--wdw-stage: #f5f6fb;
}
[data-bs-theme="dark"] {
--bs-primary: #818cf8;
--bs-primary-rgb: 129, 140, 248;
--bs-primary-text-emphasis: #c7d2fe;
--bs-primary-bg-subtle: rgba(129, 140, 248, 0.14);
--bs-primary-border-subtle: rgba(129, 140, 248, 0.35);
--bs-link-color: #a5b4fc;
--bs-link-color-rgb: 165, 180, 252;
--bs-link-hover-color: #c7d2fe;
--bs-link-hover-color-rgb: 199, 210, 254;
--bs-focus-ring-color: rgba(129, 140, 248, 0.35);
--wdw-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 16px 40px -16px rgba(0, 0, 0, 0.7);
--wdw-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 12px -4px rgba(0, 0, 0, 0.5);
--wdw-stage: #0f1117;
}
body { font-family: var(--wdw-font); -webkit-font-smoothing: antialiased; }
/* Bootstrap compiles its blue into these components; point them at the accent. */
.btn-primary {
--bs-btn-bg: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: #4338ca; --bs-btn-hover-border-color: #4338ca;
--bs-btn-active-bg: #3730a3; --bs-btn-active-border-color: #3730a3;
--bs-btn-disabled-bg: var(--bs-primary); --bs-btn-disabled-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
[data-bs-theme="dark"] .btn-primary { --bs-btn-color: #0f1117; --bs-btn-hover-bg: #a5b4fc; --bs-btn-hover-border-color: #a5b4fc; --bs-btn-hover-color: #0f1117; --bs-btn-active-color: #0f1117; }
.btn-outline-primary {
--bs-btn-color: var(--bs-primary); --bs-btn-border-color: var(--bs-primary);
--bs-btn-hover-bg: var(--bs-primary); --bs-btn-hover-border-color: var(--bs-primary);
--bs-btn-active-bg: var(--bs-primary); --bs-btn-active-border-color: var(--bs-primary);
--bs-btn-focus-shadow-rgb: var(--bs-primary-rgb);
}
.btn { --bs-btn-font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; }
.btn-sm { min-height: 36px; }
.form-control, .form-select { min-height: 44px; border-radius: .75rem; }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: rgba(var(--bs-primary-rgb), .6); box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.form-check-input:checked { background-color: var(--bs-primary); border-color: var(--bs-primary); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--bs-primary); }
.nav { --bs-nav-link-color: var(--bs-secondary-color); --bs-nav-link-hover-color: var(--bs-emphasis-color); }
.pagination { --bs-pagination-active-bg: var(--bs-primary); --bs-pagination-active-border-color: var(--bs-primary); --bs-pagination-color: var(--bs-body-color); --bs-pagination-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.progress, .progress-stacked { --bs-progress-bar-bg: var(--bs-primary); }
.list-group { --bs-list-group-active-bg: var(--bs-primary); --bs-list-group-active-border-color: var(--bs-primary); }
.dropdown-menu { --bs-dropdown-link-active-bg: var(--bs-primary); border-radius: .875rem; box-shadow: var(--wdw-shadow-sm); }
.accordion { --bs-accordion-active-bg: var(--bs-primary-bg-subtle); --bs-accordion-active-color: var(--bs-primary-text-emphasis); --bs-accordion-btn-focus-box-shadow: 0 0 0 .25rem var(--bs-focus-ring-color); }
.badge { font-weight: 600; }
/* Library building blocks — use these instead of re-inventing them per snippet. */
.wdw-stage { min-height: 100vh; display: flex; align-items: center; background: var(--wdw-stage); padding-block: 3rem; }
.wdw-card { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: var(--wdw-radius-card); box-shadow: var(--wdw-shadow); }
.wdw-card-sm { background: var(--bs-body-bg); border: 1px solid var(--bs-border-color-translucent); border-radius: 1rem; box-shadow: var(--wdw-shadow-sm); }
.wdw-aurora { position: relative; color: #fff; background: radial-gradient(60% 55% at 100% 0, #818cf8 0, transparent 70%), radial-gradient(65% 60% at 0 100%, #ec4899 0, transparent 65%), #1e1b4b; }
.wdw-eyebrow { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--bs-primary); }
.wdw-heading { font-weight: 800; letter-spacing: -.02em; color: var(--bs-emphasis-color); }
.wdw-muted { color: var(--bs-secondary-color); }
.wdw-icon { width: 2.75rem; height: 2.75rem; flex: none; display: inline-flex; align-items: center; justify-content: center; border-radius: .875rem; background: var(--bs-primary-bg-subtle); color: var(--bs-primary); }
/* Component */
.list-group-item { background: transparent; }
.set-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; padding: .25rem; border-radius: 999px; background: var(--bs-tertiary-bg); }
.set-seg label { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px; font-weight: 600; font-size: .9375rem; cursor: pointer; color: var(--bs-secondary-color); transition: background .15s, color .15s; }
.set-seg .btn-check:checked + label { background: var(--bs-body-bg); color: var(--bs-primary-text-emphasis); box-shadow: var(--wdw-shadow-sm); }
.set-seg .btn-check:focus-visible + label { outline: 3px solid var(--bs-focus-ring-color); }
.form-switch .form-check-input { cursor: pointer; margin-left: 0; float: none; }
.set-range { --val: 50%; }
.set-range::-webkit-slider-runnable-track { height: .5rem; border-radius: 999px; background: linear-gradient(to right, var(--bs-primary) var(--val), var(--bs-secondary-bg) var(--val)); }
.set-range::-moz-range-track { height: .5rem; border-radius: 999px; background: linear-gradient(to right, var(--bs-primary) var(--val), var(--bs-secondary-bg) var(--val)); }
.set-range::-webkit-slider-thumb { background: var(--bs-primary); margin-top: -.25rem; }
.set-range::-moz-range-thumb { background: var(--bs-primary); }
.flex-none { flex: none; }
.set-preview { background: var(--wdw-stage); color: var(--bs-body-color); }
.set-preview.wdw-stage { padding-block: 1rem; }
function initRanges() {
document.querySelectorAll('.set-range').forEach((range) => {
const out = document.getElementById(range.id + 'Out');
const unit = range.dataset.unit || '';
const sync = () => {
const pct = (range.value - range.min) / (range.max - range.min) * 100;
range.style.setProperty('--val', pct + '%');
const text = unit === 'percent' ? range.value + '%' : range.value + ' ' + unit;
range.setAttribute('aria-valuetext', text);
if (out) out.textContent = unit === 'minutes' ? range.value + ' min' : text;
};
range.addEventListener('input', sync);
if (range.form) range.form.addEventListener('reset', () => setTimeout(sync));
sync();
});
}
function initThemePreview() {
const stage = document.getElementById('setPreview');
if (!stage) return;
const apply = (value) => {
if (value === 'auto') stage.removeAttribute('data-bs-theme');
else stage.setAttribute('data-bs-theme', value);
};
stage.querySelectorAll('input[name="theme"]').forEach((r) => {
r.addEventListener('change', () => { if (r.checked) apply(r.value); });
});
const form = document.getElementById('settingsForm');
if (form) form.addEventListener('reset', () => apply('auto'));
}
function initSettingsSave() {
const form = document.getElementById('settingsForm');
const el = document.getElementById('setToast');
if (!form || !el) return;
const toast = bootstrap.Toast.getOrCreateInstance(el);
form.addEventListener('submit', (e) => { e.preventDefault(); toast.show(); });
form.addEventListener('reset', () => toast.hide());
}
initRanges();
initThemePreview();
initSettingsSave();
Built on Bootstrap 5.3.8 with plain JavaScript — no jQuery. Supports light and dark mode via data-bs-theme.