Skip to content

Settings Panel with Switches

Bootstrap 6 notification settings panel with switches grouped in cards, master switches per group, a pause-all toggle, unsaved-change tracking and a simulated save.

Also known as: notification settings page, notification preferences panel, settings switches groups, master switch toggle, save changes bar

Settings Panel with Switches live demo

Open in new tab

Bootstrap 6 code (HTML, CSS, JS)

A notification settings panel built with Bootstrap 6 switches. Preferences are grouped in cards for Email, Push and Quiet hours, each with a master switch, plus a "Pause everything" toggle and a dark save bar that tracks unsaved changes. Use it on account or admin settings pages.

How it works

The root .sps-root holds one <form class="sps-form">. Every preference is a Bootstrap 6 .form-field.sps-row: a .form-field-content block with the label and a .form-text hint, followed by a .switch wrapper around <input type="checkbox" role="switch" switch class="sps-item">. Each group is a <fieldset class="card sps-card" data-sps-group>, labelled by its .sps-legend heading, with a master switch .sps-master-input in .sps-card-head.

script.js listens to the form's change event and re-renders the panel:

  • A master switch that is off disables the switches of its group (their values are kept), adds .sps-card--off and sets the .sps-on counter to 0.
  • .sps-pause-input sets disabled on every group fieldset, which disables all controls inside at once, shows the .sps-paused-note alert and adds .sps-root--paused.
  • The script compares every checkbox with the last saved snapshot. The number of differences appears in .sps-status-text ("2 unsaved changes"), and Save and Discard are enabled only when something changed.

Discard restores the snapshot. Save calls preventDefault(), shows a .spinner-border.spinner-sm, locks the panel and stores a new snapshot after a timeout. Replace it with a fetch() call.

Customization

  • --sps-accent on .sps-root: recolors checked switches, the Save button, the focus ring and the eyebrow text.
  • --sps-bg, --sps-card, --sps-line and --sps-ink on .sps-root: change the page tint, card surface, dividers and the save bar.
  • --bs-switch-checked-bg in the .sps-pause .switch rule: sets the orange color of the "Pause everything" switch.
  • Add a preference by copying a .sps-row block into any .sps-rows container. Give the input the sps-item class and the counters update automatically.
  • Add a group by copying a fieldset[data-sps-group] with its .sps-master-input, .sps-on and .sps-total.
  • .sps-icon--mail, .sps-icon--push, .sps-icon--quiet: the tinted icon tiles.
  • Add switch-sm to a .switch wrapper for a smaller toggle (the pause switch already uses switch-lg).

Use cases

  • Notification preference pages: switches grouped in cards for email, push and other channels
  • Account settings: a master switch per group turns all options in that card on or off
  • Do not disturb controls: a pause-all toggle silences every notification at once
  • Forms with explicit saving: unsaved-change tracking and a simulated save confirm what was changed

Accessibility

Each switch is a real checkbox with role="switch" and a <label for>, so clicking the text toggles it and screen readers announce on/off. Master switches have an aria-label naming their group, and each fieldset uses aria-labelledby to point at its heading. Disabled fieldsets take their controls out of the tab order. The counters and the save status are polite live regions, so "1 unsaved change" or "Preferences saved" is announced. Focus rings use the accent color. The card fade transition is turned off under prefers-reduced-motion.

Bootstrap 6 notes

Bootstrap 5's .form-check.form-switch with .form-check-input becomes a .switch wrapper around an <input switch>, placed in a .form-field grid. btn-primary is now btn-solid theme-primary, alert-warning is alert theme-warning, and spinner-border-sm is spinner-sm. The panel is pinned to light mode with data-bs-theme="light". It is built on 6.0.0-alpha.1, so class names may still change before the stable release. Icons come from Bootstrap Icons.

Settings Panel with Switches at a glance

Framework
Bootstrap 6
Code
HTML, CSS, JavaScript
JavaScript
Vanilla JavaScript, no jQuery
Dependencies
Bootstrap 6, Bootstrap Icons
Layout
Responsive, works on mobile
Category
Toggles & Switches
License
Free for personal and commercial use

Questions about this template

Can I use the Settings Panel with Switches code for free?

Yes. You can copy or download the code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my website?

Load Bootstrap 6 and Bootstrap Icons from a CDN (the links are under Requirements). Paste the HTML where the component should appear, add the CSS to your stylesheet and load the JavaScript before the closing </body> tag. Download HTML gives you a complete page with everything already linked.

Does it need jQuery or a JavaScript framework?

No. The script is plain vanilla JavaScript, so it works without jQuery, React or Vue. You can still use the markup inside those frameworks.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

Requirements

Add these to your page (already included in the download):

  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/css/bootstrap.min.css">
  • <script type="module" src="https://cdn.jsdelivr.net/npm/bootstrap@6.0.0-alpha.1/dist/js/bootstrap.bundle.min.js"></script>
  • <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">

Built for Bootstrap 6.0.0-alpha.1. Bootstrap 6 ships as an ES module, so its script and this component's JavaScript load with type="module". Alpha releases can still change before the stable version.

Settings Panel with Switches – free Bootstrap 6 toggle & switch template
Settings Panel with Switches · free Bootstrap 6 toggle & switch template

More Toggles & Switches

iOS Style Toggle Switch – free Pure CSS toggle & switch template

iOS Style Toggle Switch

Pure CSS iOS style toggle switches built on real checkboxes, in a grouped settings list with three sizes, five colors and a disabled state.

Settings Toggles with Description – free Tailwind CSS toggle & switch template

Settings Toggles with Description

Tailwind CSS settings panel with accessible switches, label descriptions, a locked required option, restore defaults and an auto-save status message.

Day/Night Toggle – free Pure CSS toggle & switch template

Day/Night Toggle

Animated pure CSS day and night toggle switch where the sun turns into a cratered moon, clouds drift away and stars appear.

Toggler Button Demos – free Bootstrap 6 toggle & switch template

Toggler Button Demos

Four Bootstrap 6 Toggler demos on a dark panel: a favorite heart, a read-more expander, a light/dark theme preview and a grid/list view switch, all with data attributes.

Neumorphic Toggle Switch – free Pure CSS toggle & switch template

Neumorphic Toggle Switch

Pure CSS neumorphic toggle switches with inset shadow tracks, raised knobs and glowing indicators, built on accessible native checkboxes.

Toggle Switches with Labels – free Bootstrap 6 toggle & switch template

Toggle Switches with Labels

Dark Bootstrap 6 settings panel with .switch toggles in three sizes, labels with descriptions, disabled states and a simulated auto-save status.