48 CZ-PRG (GMT+1)
US-NYC (GMT-5)
Blazor Web App (Server rendered)

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.

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

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.

What Bootstrap 5.3 can do

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 classes data-bs-theme, .bg-body, .bg-body-secondary, .text-body, .text-body-secondary, .border, .form-check

FROM THE ATTACHED HTML

The original example

Theme previewPreference: system
data-bs-theme="light"
Body
Secondary
Accent

A PRACTICAL EXTENSION

One more way to use it

Added example
Audit more than the page background.

Verify focus rings, disabled controls, charts, images, and status colors in both modes. Keep the system option live when the operating-system preference changes.

An unhandled error has occurred. Reload 🗙

Rejoining the server...

Rejoin failed... trying again in seconds.

Failed to rejoin.
Please retry or reload the page.

The session has been paused by the server.

Failed to resume the session.
Please retry or reload the page.