BPT

Theme Loader

BptThemeLoader

The BptThemeLoader component loads and applies BptThemeBuilder themes at runtime. It supports CSS, JSON, and SCSS ZIP formats from URLs, byte arrays, or base64 strings. JSON is the recommended format — it fully preserves component-specific overrides (popup colors, selected states, hover effects, etc.) which CSS and SCSS imports cannot restore. It can run as an invisible headless component or as a dropdown theme picker.

Theme Loader Parameters
Component Preview (affected by loaded theme)
50
0 100
Current Configuration
📋
<BptThemeLoader @ref="themeLoader"
                AutoLoad="false"
                OnThemeLoaded="HandleThemeLoaded" />

@code {
    private BptThemeLoader? themeLoader;

    private async Task ApplyTheme(string themeName)
    {
        if (themeName == "Light")
        {
            await themeLoader!.ClearThemeAsync();
            return;
        }
        var config = new BptThemeConfig { ThemeName = themeName };
        // Set theme colors...
        await themeLoader!.ApplyConfigAsync(config);
    }
}
Related learning

See the Custom Theme tutorial for a step-by-step walkthrough.

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 reload the page.