METADATA ======= Last Updated: 2026-09-22 06:56 UTC Title: BlazorBlueprint - Installation and Configuration Library Version: 4 Install the styled components package (automatically includes Primitives): dotnet add package BlazorBlueprint.Components If you only need headless primitives without any styling: dotnet add package BlazorBlueprint.Primitives ================================================================================ REQUIREMENTS ================================================================================ - .NET 10 or later. The Components, Primitives and icon packages all target `net10.0`. .NET 8 and .NET 9 applications cannot consume version 4. - Consuming projects target `net10.0` and reference the 10.0.x line of the Microsoft.AspNetCore.Components packages. The BlazorBlueprint packages reference Microsoft.AspNetCore.Components.Web 10.0.12. - An interactive Blazor render mode (InteractiveServer, InteractiveWebAssembly or InteractiveAuto). See RENDER MODES & INTERACTIVE LAYOUTS below. - Keep BlazorBlueprint.Components and BlazorBlueprint.Primitives on matching version 4 releases. ================================================================================ SERVICE REGISTRATION ================================================================================ In your Program.cs, register the BlazorBlueprint services: // Register all services (Primitives + Components) builder.Services.AddBlazorBlueprintComponents(); // OR register only primitive services // (no ToastService, DialogService, ThemeService or IBbLocalizer) builder.Services.AddBlazorBlueprintPrimitives(); AddBlazorBlueprintComponents() registers everything that AddBlazorBlueprintPrimitives() does, plus the component-level services (ToastService, DialogService, ThemeService, IBbLocalizer). You do not need to call both for a standard setup. Signatures: // namespace BlazorBlueprint.Components IServiceCollection AddBlazorBlueprintComponents( this IServiceCollection services, Action? configureLocalizer = null, Action? configureTheme = null, Action? configureOverlays = null) // namespace BlazorBlueprint.Primitives.Extensions IServiceCollection AddBlazorBlueprintPrimitives( this IServiceCollection services, Action? configureOverlays = null) configureLocalizer Override localization strings (see localization.txt). configureTheme Set ThemeService defaults (see services.txt and components/theme.txt). configureOverlays Set the app-wide default overlay rendering strategy (below). Both methods take it; AddBlazorBlueprintComponents passes it straight to AddBlazorBlueprintPrimitives. Native rendering (optional): BbDialog can render through the browser's native element instead of the portal. A native dialog lives in the browser's top layer, needs no BbPortalHost, and works across render-mode boundaries (for example a dialog opened from an InteractiveWebAssembly island inside a static layout). In a browser without .showModal(), the library falls back to the JavaScript strategy: BbDialogContent logs a warning, re-renders itself through the portal, and every overlay resolved afterwards in that scope takes the JavaScript path too (INativeOverlayService.FallBackToJavaScript, see services.txt). Support can only be established through JS interop, so the fallback happens on the first native render rather than being predicted before it. BbPortalHost still has to be present for the fallback to show anything. Per dialog: ... App-wide default (OverlayRenderingOptions.DefaultStrategy, default OverlayRenderingStrategy.JavaScript). Configure it on either registration call: using BlazorBlueprint.Components; using BlazorBlueprint.Primitives.Services; builder.Services.AddBlazorBlueprintComponents(configureOverlays: o => o.DefaultStrategy = OverlayRenderingStrategy.Native); Or on AddBlazorBlueprintPrimitives, in either order relative to AddBlazorBlueprintComponents: using BlazorBlueprint.Primitives.Extensions; using BlazorBlueprint.Primitives.Services; builder.Services.AddBlazorBlueprintPrimitives(o => o.DefaultStrategy = OverlayRenderingStrategy.Native); builder.Services.AddBlazorBlueprintComponents(); AddBlazorBlueprintComponents() calls AddBlazorBlueprintPrimitives() internally. The OverlayRenderingOptions instance is registered once and configured in place, so a second call configures the same instance instead of replacing it: before or after gives the same result, and every configure action supplied runs, in call order. OverlayRenderingStrategy (namespace BlazorBlueprint.Primitives.Services): JavaScript Render through the portal system with Floating UI positioning (default). Native Use the browser's native element in the top layer. Only BbDialog has a RenderingStrategy parameter. Components built on the dialog primitive without that parameter follow the app-wide default: BbAlertDialog, BbCommandDialog, the link dialog of BbRichTextEditor and the event editor dialog of BbScheduler. The other portal-based overlays (BbSheet, BbPopover, BbTooltip, BbSelect and the rest) always use the portal path. ================================================================================ STYLESHEET AND SCRIPT TAGS ================================================================================ In v4.1.0, BbRichTextEditor loads the bundled Quill 2.0.3 script and core stylesheet on demand. No CDN tags are needed for the editor. A version 4 host adds these tags. For a Blazor Web App (Server, WebAssembly or Auto render modes) they go in App.razor; for a standalone Blazor WebAssembly app they go in wwwroot/index.html. ... In a standalone WebAssembly index.html there is no / markup (root components are added in Program.cs) and the framework script is _framework/blazor.webassembly.js. Primitives-only applications (BlazorBlueprint.Primitives without BlazorBlueprint.Components) load the primitives stylesheet instead of blazorblueprint.css: It is small and carries no design decisions. It defines only the rules the primitives' own markup depends on: the offscreen placement of floating content that has not been positioned yet (`[data-positioned="false"]`), the visually hidden class that holds BbSortable's live announcements and keyboard instructions (`bb:sr-only`), and the positioning utilities behind BbMenubarContent's dismiss overlay and BbTableRow's focus ring (`bb:fixed`, `bb:inset-0`, `bb:z-40`, `bb:relative`). Without it, BbSortable's keyboard instructions render as ordinary body text and the menubar dismiss overlay has no size. An application that uses BlazorBlueprint.Components does not need it: blazorblueprint.css already defines those classes, and the declarations match, so loading both is harmless. JavaScript modules need no tags. The components import their own ES modules on demand, including the shared core bundles _content/BlazorBlueprint.Components/js/bb-components-core.js (theme, sidebar, sidebar inset, text input and IME composition guard) and _content/BlazorBlueprint.Primitives/js/primitives/bb-primitives.js. The import URLs of these two bundles carry the library version as a query string, so a new release is fetched fresh rather than served from a stale browser or CDN cache. Apache ECharts for the chart components is also bundled and loaded on demand. ================================================================================ TAILWIND AND THE bb: UTILITY PREFIX ================================================================================ blazorblueprint.css is a prebuilt Tailwind CSS stylesheet. No Tailwind setup is required for the components themselves. Every Tailwind utility the library emits is prefixed `bb:` (for example `.bb\:flex`, `.bb\:sm\:hidden`, `.bb\:data-\[state\=open\]\:bg-accent`) and lives in its own `bb-utilities` cascade layer. The library's classes and a consumer's own Tailwind classes can never share a name, so they never collide. Consumer `Class` values stay unprefixed. The class merge (ClassNames.cn) strips the library prefix before resolving conflicts, so `Class="p-6"` still replaces the component's own `bb:p-4`: @* renders class="... p-6 ...", the library's bb:p-4 removed *@ `group` and `peer` markers are the exception: they reach the DOM in both forms. Tailwind resolves a `group-*` or `peer-*` variant against a literal marker class, and your own build never sees the library prefix, so it compiles `group-data-[state=open]:rotate-180` to a rule matching `:where(.group)` and never `:where(.bb\:group)`. Library markup that acts as a marker therefore renders the bare class next to the prefixed one — `class="group bb:group ..."`, and for a named marker `class="peer/menu-button bb:peer/menu-button ..."` — so your own `group-*` and `peer-*` utilities apply to library markup: Inbox The variant itself is an ordinary utility, not a marker, so it is only ever emitted with the prefix inside blazorblueprint.css. The unprefixed `group-data-[collapsible=icon]:hidden` above has to come from your application's own Tailwind build (Scenario A below). Scenario A: your app runs its own Tailwind build - No markup changes. Keep writing standard Tailwind classes in pages and in component Class parameters. - Do not `@source` the BlazorBlueprint package or its sources from your Tailwind input. It is not needed, and it would only find `bb:`-prefixed tokens that your build does not recognize, so it emits nothing. - Load order does not matter for utilities: put your Tailwind output before or after blazorblueprint.css. - Keep your theme variables stylesheet before blazorblueprint.css. Scenario B: your app has no Tailwind build blazorblueprint.css only contains the `bb:`-prefixed utilities the components use. Standard classes you write in your own markup, such as `class="flex gap-4"`, match nothing in it, and a component `Class` value only takes effect if some stylesheet defines that class. Two options: - Add a Tailwind build to the project (the supported path). The Tailwind standalone CLI needs no Node.js. - Stopgap: use the prefixed classes directly, for example `class="bb:flex bb:gap-4"`. They work anywhere on the page, but the available set is only what the components happen to use and can change between versions, so this is not an API. Safelisted utilities that are always present in blazorblueprint.css and meant to be applied by name: bb:shimmer Animated gradient sweep across text, for in-progress labels. bb:scroll-fade-x Fades the left and right edges of a horizontal scroll container. Cascade layers declared by blazorblueprint.css, lowest to highest priority: properties, theme, base, components, bb-utilities, utilities, bb - theme, base, components and utilities are the standard Tailwind layers a consumer build also writes into. Tailwind's preflight reset is unprefixed and shared (element selectors only). - bb-utilities holds the library's prefixed utilities. - bb is the strongest layer and holds BlazorBlueprint's hand-authored component CSS (attribute-selector rules), so those rules win against a consumer's layered Tailwind output (utilities and preflight) regardless of order. As with any cascade layers, unlayered CSS in your own stylesheets still takes precedence over all layered rules. ================================================================================ APPLYING THE SAVED THEME BEFORE FIRST PAINT ================================================================================ ThemeService stores the user's theme in localStorage, which the server cannot read during prerendering. Without an early script the page paints with the default theme and switches after Blazor starts, so a dark-mode user sees a flash of light. Add theme-init.js to , after your stylesheets: - It must be a classic, blocking script. Do not add type="module", async or defer: those can run after the first paint. - It is a separate file rather than inline script, so a strict Content-Security-Policy needs no 'unsafe-inline'. - Before the first paint it applies to : the `dark` class, `data-base-color`, `data-primary-color`, the `--radius` custom property, and the design attributes `data-bb-density`, `data-bb-font`, `data-bb-surface`, `data-bb-menu-color` and `data-bb-menu-accent`. Options, set as data attributes on the same