BlazorFastMarquee 1.0.4
dotnet add package BlazorFastMarquee --version 1.0.4
NuGet\Install-Package BlazorFastMarquee -Version 1.0.4
<PackageReference Include="BlazorFastMarquee" Version="1.0.4" />
<PackageVersion Include="BlazorFastMarquee" Version="1.0.4" />
<PackageReference Include="BlazorFastMarquee" />
paket add BlazorFastMarquee --version 1.0.4
#r "nuget: BlazorFastMarquee, 1.0.4"
#:package BlazorFastMarquee@1.0.4
#addin nuget:?package=BlazorFastMarquee&version=1.0.4
#tool nuget:?package=BlazorFastMarquee&version=1.0.4
Blazor Fast Marquee
Blazor Fast Marquee is a high-performance marquee component for Blazor inspired by the battle-tested react-fast-marquee library. It delivers the same API surface while embracing .NET's ahead-of-time (AOT) compilation and aggressive trimming so your applications remain lean without sacrificing fidelity.
Why another marquee? Because shipping to WebAssembly or native ahead-of-time targets demands components that are deterministic, trimming safe, and optimized from the first render. Blazor Fast Marquee was built from the ground up with those goals in mind.
Live Demo
Examples
Highlights
- ⚡ API parity with React Fast Marquee. Drop-in familiar parameters such as
speed,gradientColor,pauseOnHover, and lifecycle callbacks likeonCycleComplete. - 🖱️ Interactive drag support. Enable drag-to-pan for desktop and mobile with
EnableDrag. Automatically respects direction (horizontal for left/right, vertical for up/down). - 🪶 Trimming-friendly by design. The library is marked as trimmable, ships without reflection, and has analyzers enabled so you can confidently publish with
PublishTrimmed=true. - 🚀 AOT ready.
RunAOTCompilationis enabled so the component is validated against Native AOT constraints during publish. - 🧭 Deterministic layout. A lightweight JavaScript module only measures the rendered width/height and falls back gracefully when observers are unavailable.
- 🧩 Composable. Works with any child content—text, components, images, or complex layouts.
Getting Started
Installation
Install the package from NuGet:
dotnet add package BlazorFastMarquee
Setup
1. Configure your Blazor app in Program.cs:
For Blazor WebAssembly:
var builder = WebAssemblyHostBuilder.CreateDefault(args);
builder.RootComponents.Add<App>("#app");
// ... rest of your configuration
await builder.Build().RunAsync();
For Blazor Server or Blazor Web App:
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents(); // If using WebAssembly interactivity
2. CSS and JavaScript are automatically included via Blazor's static web assets system. The component's styles (Marquee.razor.css) and JavaScript module (Marquee.razor.js) are bundled and served automatically—no manual script or link tags required.
3. Import the namespace in your _Imports.razor:
@using BlazorFastMarquee
Usage
Basic example:
@page "/marquee-demo"
@using BlazorFastMarquee
<Marquee Speed="80" Gradient GradientColor="#111827" GradientWidth="128">
<div class="marquee-chip">🚀 Blazor Fast Marquee</div>
<div class="marquee-chip">🔥 AOT-ready animations</div>
<div class="marquee-chip">🧭 Deterministic layout</div>
</Marquee>
With drag support:
<Marquee Speed="50" EnableDrag="true" Direction="MarqueeDirection.Left" Gradient>
<div class="marquee-chip">🖱️ Drag me!</div>
<div class="marquee-chip">👆 Click & hold to pan</div>
<div class="marquee-chip">📱 Touch support included</div>
</Marquee>
Add some styling (optional):
.marquee-chip {
padding: 0.5rem 1rem;
margin-right: 1rem;
border-radius: 9999px;
background: rgba(59, 130, 246, 0.12);
}
Production Builds with Trimming & AOT
Blazor Fast Marquee is validated with trimming analyzers and Native AOT so you can ship the smallest possible payloads. When publishing your application run:
dotnet publish -c Release -p:PublishTrimmed=true -p:TrimMode=link -p:RunAOTCompilation=true
The library opts into invariant globalization to minimize ICU payload size. If your app requires full globalization data, override InvariantGlobalization in your project file.
Props
| Parameter | Type | Default | Description |
|---|---|---|---|
Style |
string? |
string.Empty |
Inline style for the container <div>. |
ClassName |
string? |
string.Empty |
Additional CSS class names for the container <div>. |
AutoFill |
bool |
false |
Automatically duplicates content to fill unused marquee space. |
Play |
bool |
true |
Whether the marquee animation is running. |
PauseOnHover |
bool |
false |
Pause the marquee while the pointer hovers over it. |
PauseOnClick |
bool |
false |
Pause the marquee when the container is pressed. |
EnableDrag |
bool |
false |
Enable drag-to-pan functionality. Users can click/touch and drag to manually pan the marquee (respects direction). Animation pauses during drag. |
Direction |
MarqueeDirection (Left, Right, Up, Down) |
MarqueeDirection.Left |
Direction of travel. Vertical marquees rotate content to maintain orientation. |
Speed |
double |
50 |
Speed in pixels per second. |
Delay |
double |
0 |
Delay in seconds before the animation starts. |
Loop |
int |
0 |
Number of times the marquee loops. 0 means infinite. |
Gradient |
bool |
false |
Enables a fade gradient overlay at the edges. |
GradientColor |
string |
"white" |
Color used by the gradient overlay. |
GradientWidth |
CssLength (double, int, or string) |
200 |
Width of the gradient on both sides. |
OnFinish |
EventCallback |
default |
Invoked after the marquee finishes all loops (Loop > 0). |
OnCycleComplete |
EventCallback |
default |
Invoked at the end of each animation cycle. |
OnMount |
EventCallback |
default |
Invoked once after the marquee has measured its layout. |
ChildContent |
RenderFragment? |
null |
The content rendered inside the marquee. |
Accessibility & Performance Tips
- Prefer semantic markup inside
ChildContentand providearia-labels when the marquee conveys essential information. - Keep
Speedwithin a comfortable range and consider offering controls to pause for accessibility compliance. - Combine marquees with
prefers-reduced-motionto disable animations for users who request it.
Testing
The solution includes automated BUnit tests covering layout measurement, callbacks, and attribute forwarding. Run them locally with:
dotnet test
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
-
net9.0
- Microsoft.AspNetCore.Components.Web (>= 9.0.10)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
See https://github.com/Zettersten/BlazorFastMarquee/releases for release notes.