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:
- Theme — toggle between Light, Dark, and System (System follows the OS preference and updates live when it changes).
- Color — pick a brand accent color. The grid, buttons, links, and focus rings all recolor to match.
- Direction — flip the entire layout between left-to-right and right-to-left to preview your RTL story.
- Language — switch between every culture configured on the server (this demo's gear hides this section; your own portal can show it via
AllowLanguageChange).
Note
Your selection persists in
localStorageunder 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 layout's header alongside the rest of your top-bar controls, and make sure the app is wrapped in a theme provider so the panel has a theme to drive. The Blazor and React tabs below mirror how each template wires it up:
// App.tsx — wrap the whole app so the panel has a theme to drive
<PowerPortalsProThemeProvider style={{ height: '100%' }}>
<PowerPortalsProProvider>
{/* dialog + overlay providers, RouterProvider, ... */}
</PowerPortalsProProvider>
</PowerPortalsProThemeProvider>
// Layout.tsx — header slot, alongside your other top-bar controls
<div className={styles.identity}>
<SiteSettingsButton />
<ProfileMainMenu signInUrl="/Account/Login" accountUrl="/Account/Manage" />
</div>@* 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
The theme provider namespaces the per-user preferences in
localStorage— viaStorageNameon Blazor's<ThemeProvider>, orstorageKeyon React's<PowerPortalsProThemeProvider>. Use a name unique to your portal so multiple portals on the same domain don't clash.
Fixing the accent color to your brand
By default the accent color belongs to the visitor, and their pick outlives any default you configure. Portals that have to stay on-brand can pin it instead: set the accent on the theme provider and turn the lock on. The configured color then wins over whatever the visitor picked previously, the stored preference is rewritten to match, and the accent picker removes itself from the settings panel. Light / dark mode stays the visitor's to choose either way.
// App.tsx — one of the built-in Office accents
<PowerPortalsProThemeProvider defaultAccentColor="word" lockAccentColor>
{/* dialog + overlay providers, RouterProvider, ... */}
</PowerPortalsProThemeProvider>
// or your own brand ramp, registered at the 'default' key
const brand: BrandVariants = { 10: '#001005', /* ... */ 160: '#ffffff' };
<PowerPortalsProThemeProvider
customAccents={{
default: { light: createLightTheme(brand), dark: createDarkTheme(brand) },
}}
lockAccentColor
>@* MainLayout.razor — any CSS hex value; this one is Word's blue *@
<ThemeProvider StorageName="theme"
CustomColor="#2b579a"
LockAccentColor="true" />Note
Without the lock, an accent on the theme provider is only a default — it applies to first-time visitors and is overridden the moment someone picks their own. Hiding the picker with
AllowColorChange="false"doesn't set a color either; it only hides the section, leaving anyone who already chose an accent on that choice. Reach for the lock when the color actually matters.
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.
AllowLanguageChange— defaults totrue. Show the language picker. Set tofalseon single-language portals so the section doesn't show up empty.AllowThemeChange— defaults totrue. Show the light / dark / system toggle.AllowColorChange— defaults totrue. Show the accent color picker. Disable when your brand mandates a specific accent.AllowRightToLeftChange— defaults tofalse. Show the text-direction switch. Enable only when your portal actively supports RTL content.
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 |
|---|---|---|---|
AllowColorChange | bool | True | Gets or sets whether the accent colour selection section is visible in the settings panel. |
AllowLanguageChange | bool | True | Gets or sets whether the language selection section is visible in the settings panel. |
AllowRightToLeftChange | bool | False | Gets or sets whether the text direction (LTR/RTL) selection section is visible in the settings panel. |
AllowThemeChange | bool | True | Gets or sets whether the theme (light/dark/system) selection section is visible in the settings panel. |
AllowColorChangeAllowLanguageChangeAllowRightToLeftChangeAllowThemeChange