CanDoItAll.Components.OverlayLib
0.3.0
dotnet add package CanDoItAll.Components.OverlayLib --version 0.3.0
NuGet\Install-Package CanDoItAll.Components.OverlayLib -Version 0.3.0
<PackageReference Include="CanDoItAll.Components.OverlayLib" Version="0.3.0" />
<PackageVersion Include="CanDoItAll.Components.OverlayLib" Version="0.3.0" />
<PackageReference Include="CanDoItAll.Components.OverlayLib" />
paket add CanDoItAll.Components.OverlayLib --version 0.3.0
#r "nuget: CanDoItAll.Components.OverlayLib, 0.3.0"
#:package CanDoItAll.Components.OverlayLib@0.3.0
#addin nuget:?package=CanDoItAll.Components.OverlayLib&version=0.3.0
#tool nuget:?package=CanDoItAll.Components.OverlayLib&version=0.3.0
CanDoItAll.Components.OverlayLib
OverlayLib supplies floating, task-focused windows for Blazor pages. Use it when a user needs a supporting tool - an inspector, filter panel, live status, or preview - without navigating away from the current work.
OverlayWindow is deliberately bounded: it lives inside a host frame, can respect a toolbar/safe-top area, and provides consistent drag, resize, minimize, reset, hide, and show behavior. It complements normal page content; it should not become a replacement for page navigation or an unbounded desktop-window imitation.
Add it once
Import the namespace and include the generated assets in the host document. This has no npm runtime dependency.
@using CanDoItAll.Components.OverlayLib
@* App.razor *@
<head>
...
<OverlayLibHeadAssets />
</head>
<body>
...
<OverlayLibBodyAssets IncludeRuntimeAssets="true" />
</body>
Theme colors
Overlay windows and component toolboxes follow the nearest data-ui-theme boundary when BaseLib styles are loaded.
Override --ui-overlay-surface, --ui-overlay-surface-soft, --ui-overlay-border, --ui-overlay-border-soft,
--ui-overlay-text, --ui-overlay-text-strong, --ui-overlay-text-muted, and --ui-overlay-shadow-color in that
scope to customize their chrome. Status badges use --ui-overlay-{info,secondary,success,warning,danger}-{bg,fg,border}.
Set each background/foreground pair together to retain contrast.
These variables resolve from BaseLib's current --tone-* contract at every theme boundary, including nested light
and dark hosts. Omitting BaseLib styles keeps the existing light fallback palette; the overlay runtime and window
state do not depend on a theme module. No additional assets or component parameters are required.
A bounded floating inspector
The host frame must be positioned and have a meaningful size. Pass selectors for the container and, when present, the toolbar that the window must not cover. Store OverlayWindowState in the page or feature state; the StateChanged callback is where drag, resize, and visibility changes come back to your application.
DefaultPlacement accepts top-left, top-center and top-right. Centered placement
can keep an index between left and right tools on a desktop canvas. Saved coordinates
override the default; reset restores it within the same container and safe toolbar inset.
Delayed geometry notifications cannot reopen a hidden or disposed window. They are ignored while the host processes Hide; a rejected Hide still propagates its error and leaves the visible window usable. The host continues to own and echo the controlled window state.
Set KeepContentMountedWhenMinimized="true" for an editor or active conversation whose
unsent input and component state must survive minimize/restore. Its body stays mounted
under a hidden element, so subscriptions also stay alive. The default remains false and
disposes minimized content. The host still owns hiding, closing and final disposal.
Use HeaderLeading for an avatar or identifying icon and HeaderStatus for current
activity. Both optional fragments stay mounted in the same header through minimize and
restore. Activity remains visible in the minimized window; the summary and reset action
are hidden. CanvasFloatingWindow forwards both slots. Keep status text short and let
the feature own its updates, including any subscriptions retained in the body.
Pointer resizing stays in the browser until release. Geometry acknowledgements from an
earlier gesture do not rewind a newer local size; reset, minimize and visibility changes
remain controlled by the host. The same observer clamps the current geometry when its
container changes. Disposal releases pointer listeners and pending geometry work.
The outer frame keeps zero scroll offsets so focus after resize cannot clip its header;
the body and nested transcripts still own their ordinary scrolling.
Run npm run overlaylib:test-resize for the deterministic resize/echo regression cases;
npm run assets:verify includes them. Browser proof should include a delayed state echo
while the user performs a second resize and content continues updating.
<div class="relative min-h-[28rem] overflow-hidden rounded-2xl border"
data-testid="review-frame">
<header class="relative z-10 border-b p-3" data-testid="review-toolbar">
Review tools
</header>
<section class="p-6">Your ordinary page content remains here.</section>
@if (inspector.IsVisible)
{
<OverlayWindow WindowId="review-inspector"
Title="Inspector"
Summary="Supporting context for this review."
State="@inspector"
StateChanged="HandleInspectorChanged"
DefaultPlacement="top-right"
ContainerSelector="[data-testid='review-frame']"
SafeTopSelector="[data-testid='review-toolbar']">
<TextBlock TextStyle="TextStyle.Body2"
Value="This panel can move without taking the user away from the page." />
</OverlayWindow>
}
</div>
@code {
private OverlayWindowState inspector = new();
private Task HandleInspectorChanged(OverlayWindowState next)
{
inspector = OverlayWindowState.Normalize(next);
return Task.CompletedTask;
}
}
OverlayLib and CanvasLib
OverlayLib owns the generic window lifecycle and browser runtime. CanvasLib uses it through CanvasFloatingWindow, adding a canvas-specific state type and default stage boundaries. Use OverlayWindow on ordinary pages; use CanvasFloatingWindow inside CanvasWorkbench.OverlayContent when the panel belongs to a workbench. See the Canvas guide for that composition.
See it running
The Sandbox route /groups/overlays renders a standard BaseLib review frame with a real OverlayWindow. It is the visual reference for bounded placement, safe-top behavior, and hide/show/minimize flows. The companion Canvas example lives at /groups/canvas.
Development
dotnet build src/CanDoItAll.Components.OverlayLib/CanDoItAll.Components.OverlayLib.csproj --no-restore
dotnet test tests/CanDoItAll.Components.BaseLib.Tests/CanDoItAll.Components.BaseLib.Tests.csproj --filter FullyQualifiedName~CanvasOverlayPublishingApprovalTests --no-restore
Targets net10.0. The package references BaseLib and Microsoft.AspNetCore.Components.Web; it requires no npm runtime package.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- CanDoItAll.Components.BaseLib (>= 0.3.0)
- Microsoft.AspNetCore.Components.Web (>= 10.0.14)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on CanDoItAll.Components.OverlayLib:
| Package | Downloads |
|---|---|
|
CanDoItAll.Components.CanvasLib
Canonical shared canvas runtime for active CanDoItAll workbench surfaces. |
|
|
CanDoItAll.Components.WebGlLib
Universal WebGL workbench concept runtime with typed scene contracts and deterministic browser proof hooks. |
GitHub repositories
This package is not used by any popular GitHub repositories.