Theme & Site Settings

Every PowerPortalsPro portal ships with a built-in side panel that lets your visitors switch themes, accent colors, text direction, and language without any custom UI work on your part. The panel is launched from the <SiteSettingsButton> — a small gear icon you place in the page header — and the rest of the framework reacts live to whatever the visitor picks.

Try it in this demo

Look in the top-right of every page in this demo for the gear icon — the same <SiteSettingsButton> wired up in this site's MainLayout.razor. Click it and a side panel opens with:

Note

Your selection persists in localStorage under the key supplied via <ThemeProvider StorageName="…">, so a refresh keeps your choice. Hit Reset settings at the bottom of the panel to clear the preference and fall back to the theme defaults.

Wiring it up in your own portal

Drop a <SiteSettingsButton> into your MainLayout.razor header alongside the rest of your top-bar controls, and a <ThemeProvider> at the bottom of the layout so the panel has a theme to drive. The snippet below mirrors how this demo's MainLayout.razor wires it up:

@* MainLayout.razor — header slot *@
<FluentStack Orientation="Orientation.Horizontal"
             HorizontalAlignment="HorizontalAlignment.End"
             VerticalAlignment="VerticalAlignment.Center">
    <ProfileMainMenu />
    <SiteSettingsButton AllowColorChange="true"
                        AllowLanguageChange="false"
                        AllowRightToLeftChange="true"
                        AllowThemeChange="true" />
</FluentStack>

@* … the rest of MainLayout.razor … *@

@* Bottom of the layout — drives the theme the panel just changed *@
<ThemeProvider StorageName="theme" />

Note

StorageName on <ThemeProvider> namespaces the per-user preferences in localStorage. Use a name unique to your portal so multiple portals on the same domain don't clash.

Which sections to show

Each section of the panel is gated by a boolean parameter on <SiteSettingsButton>. Set the ones you want hidden to false; the panel reflows around them.

If you turn all four sections off, the button hides itself — there's nothing useful for the panel to display.

API Reference

SiteSettingsButton Class

Parameters

Name
Type
Default
Description
AllowColorChangebool
True
Gets or sets whether the accent colour selection section is visible in the settings panel.
AllowLanguageChangebool
True
Gets or sets whether the language selection section is visible in the settings panel.
AllowRightToLeftChangebool
False
Gets or sets whether the text direction (LTR/RTL) selection section is visible in the settings panel.
AllowThemeChangebool
True
Gets or sets whether the theme (light/dark/system) selection section is visible in the settings panel.
Name: AllowColorChange
Type: bool
Default: True
Description: Gets or sets whether the accent colour selection section is visible in the settings panel.
Name: AllowLanguageChange
Type: bool
Default: True
Description: Gets or sets whether the language selection section is visible in the settings panel.
Name: AllowRightToLeftChange
Type: bool
Default: False
Description: Gets or sets whether the text direction (LTR/RTL) selection section is visible in the settings panel.
Name: AllowThemeChange
Type: bool
Default: True
Description: Gets or sets whether the theme (light/dark/system) selection section is visible in the settings panel.