Blazor Theme Switcher
Documentation and examples for using Blazor Bootstrap Theme Switcher components.
Parameters
Name | Type | Default | Required | Description | Added Version |
---|---|---|---|---|---|
Position | DropdownMenuPosition | DropdownMenuPosition.Start | ✔️ | Gets or sets the dropdown menu position. | 3.2.0 |
Events
Event | Description | Added Version |
---|---|---|
OnThemeChanged | Fired when the theme is changed. | 3.2.0 |
Examples
How it works
<ThemeSwitcher Position="DropdownMenuPosition.End" />
Position
<div class="float-end">
<ThemeSwitcher Position="DropdownMenuPosition.End" />
</div>
Events
<ThemeSwitcher OnThemeChanged="OnThemeChanged" />
@code
{
[Inject]
ToastService ToastService { get; set; } = default!;
private void OnThemeChanged(string themeName)
{
// do something when the theme changes
ToastService.Notify(new(ToastType.Success, $"Theme changed to {themeName}"));
}
}