Skip to content

SyncfusionExamples/theme-switching-in-blazor-WASM-app

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theme Switching in Blazor WASM App

This repository contains a sample Blazor WebAssembly application demonstrating how to switch themes dynamically in a .NET 10 Blazor app using a shared layout, a Syncfusion theme selector, and runtime stylesheet updates.

Features

  • Dynamic Theme Switching: Updates the active Blazor theme without reloading the app
  • Built-in Theme Selection: Provides a DropDownList with light, dark, and high-contrast theme options
  • Shared Layout Experience: Keeps the theme switcher available across all pages
  • Runtime Style Loading: Uses a JavaScript helper to swap the theme stylesheet on demand
  • Blazor Routing and Interactivity: Includes sample pages for navigation and basic component behavior

Prerequisites

Run the sample in Visual Studio Code

  1. Open the project folder in Visual Studio Code.

  2. Install the recommended extensions if prompted.

  3. Open the integrated terminal (Ctrl + ~).

  4. Restore NuGet packages:

    dotnet restore
  5. Build the project:

    dotnet build
  6. Run the application:

    dotnet run
  7. Open the URL shown in the terminal. The local port may vary depending on your environment and launch profile.

References

About

This example shows how to switch theme dynamically in blazor WASM app.

Topics

Resources

Stars

Watchers

Forks

Contributors