WEB DESIGN TRENDS / 16 OF 20
Dark Mode Toggling
A complete theme switch updates surfaces, text, controls, and contrast together. The source example supports light, dark, and system preferences through Bootstrap's data-bs-theme and CSS variables.
DESCRIPTION & USE
How the trend works
A complete theme switch updates surfaces, text, controls, and contrast together. The source example supports light, dark, and system preferences through Bootstrap's data-bs-theme and CSS variables.
Where to use it
Offer a theme choice when visitors benefit from it, and respect their operating-system preference by default. Check every visual state, including forms, borders, and subtle text.
Bootstrap 5.3 supports light and dark color modes with data-bs-theme. Its semantic color and text utilities follow the active theme automatically.
Useful classesdata-bs-theme, .bg-body, .bg-body-secondary, .text-body, .text-body-secondary, .border, .form-checkFROM THE ATTACHED HTML
The original example
A PRACTICAL EXTENSION
One more way to use it
Verify focus rings, disabled controls, charts, images, and status colors in both modes. Keep the system option live when the operating-system preference changes.