FastComponents 0.0.0-alpha.0.33

This is a prerelease version of FastComponents.
dotnet add package FastComponents --version 0.0.0-alpha.0.33
                    
NuGet\Install-Package FastComponents -Version 0.0.0-alpha.0.33
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="FastComponents" Version="0.0.0-alpha.0.33" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FastComponents" Version="0.0.0-alpha.0.33" />
                    
Directory.Packages.props
<PackageReference Include="FastComponents" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add FastComponents --version 0.0.0-alpha.0.33
                    
#r "nuget: FastComponents, 0.0.0-alpha.0.33"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package FastComponents@0.0.0-alpha.0.33
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=FastComponents&version=0.0.0-alpha.0.33&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=FastComponents&version=0.0.0-alpha.0.33&prerelease
                    
Install as a Cake Tool

FastComponents

Server-side Blazor components rendered as HTMX-powered HTML fragments -- build interactive web UIs with .NET 10 and zero client-side Blazor runtime.

Atypical-Consulting - FastComponents License: Apache-2.0 .NET 10 stars - FastComponents forks - FastComponents

GitHub tag issues - FastComponents GitHub pull requests GitHub last commit

Build

NuGet


Table of Contents

The Problem

Building interactive web UIs with .NET typically means choosing between the full Blazor Server runtime (with WebSocket overhead and connection state) or Blazor WASM (with large download sizes). If you just want lightweight, server-rendered HTML fragments that respond to user interactions -- the HTMX model -- there is no first-class Blazor integration. You end up writing raw HTML strings or abandoning the Razor component model entirely.

The Solution

FastComponents bridges Blazor's server-side Razor component model with HTMX. You author components using familiar .razor syntax with full C# support, and FastComponents renders them as plain HTML fragments served via FastEndpoints. HTMX on the client handles partial page updates -- no WebSocket connections, no WASM downloads, just HTTP requests and HTML responses.

// Define a component with HTMX attributes using the HtmxTag helper
<HtmxTag
    As="button"
    HxGet="/api/counter?Count=1"
    HxSwap="outerHTML"
    HxTarget="#counter">
    Increment
</HtmxTag>

Features

  • HtmxComponentBase -- base class with all htmx attributes as Blazor [Parameter] properties
  • HtmxTag -- generic Razor component that renders any HTML element with htmx attributes
  • HtmxComponentEndpoint<TComponent> -- serve components as HTML via FastEndpoints routes
  • HtmxComponentEndpoint<TComponent, TParameters> -- typed parameter binding from query strings
  • HtmxComponentParameters -- immutable record base with automatic query string serialization
  • ComponentHtmlResponseService -- render any Blazor component to an HTML string on the server
  • ClassNamesBuilder -- fluent, conditional CSS class builder (similar to classnames in JS)
  • Hx.Swap constants and Hx.TargetId() helper for type-safe htmx attribute values
  • Bundled htmx.min.js as a static web asset
  • NuGet package with auto-generated API documentation
  • HTML beautifier for formatted output (stub implemented)
  • AOT compilation support (planned)
  • Project template for dotnet new (planned)

Tech Stack

Layer Technology
Runtime .NET 10.0 / C# 14
Component model Blazor SSR (Microsoft.AspNetCore.Components.Web 10.0)
Endpoint routing FastEndpoints 8.0
HTML parsing AngleSharp 1.4
Client interactivity htmx (bundled)
Versioning MinVer (git-tag based)
CI/CD GitHub Actions (build, NuGet pack, validate, publish)

Getting Started

Prerequisites

Installation

Option 1 -- NuGet (recommended)

dotnet add package FastComponents

Option 2 -- From Source

git clone https://github.com/Atypical-Consulting/FastComponents.git
cd FastComponents
dotnet build

Setup

Register FastComponents in your Program.cs:

var builder = WebApplication.CreateBuilder(args);

// Add FastComponents services (registers FastEndpoints + HTML renderer)
builder.Services.AddFastComponents();

var app = builder.Build();

app.UseStaticFiles();

// Map component endpoints
app.UseFastComponents();

app.Run();

Usage

Define a component

Create a Razor component that inherits from HtmxComponentBase:

@* Counter.razor *@
@inherits HtmxComponentBase<CounterEndpoint.CounterParameters>

<section id="block-counter">
    <HtmxTag
        As="button"
        HxGet="@Parameters.Increment()"
        HxSwap="@Hx.Swap.OuterHtml"
        HxTarget="@Hx.TargetId("block-counter")">
        Increment
    </HtmxTag>

    <span>Count: @Parameters.Count</span>
</section>

Wire it to an endpoint

// Counter.razor.cs
public class CounterEndpoint
    : HtmxComponentEndpoint<Counter, CounterEndpoint.CounterParameters>
{
    public override void Configure()
    {
        Get("/ui/blocks/counter");
        AllowAnonymous();
    }

    public record CounterParameters : HtmxComponentParameters
    {
        public int Count { get; init; } = 0;

        public string Increment()
        {
            var next = this with { Count = Count + 1 };
            return next.ToComponentUrl("/ui/blocks/counter");
        }
    }
}

When the button is clicked, htmx sends a GET request to /ui/blocks/counter?Count=1, FastComponents renders the Blazor component server-side, and the HTML fragment replaces the target element -- no JavaScript framework required.

Architecture

Browser (htmx)                    ASP.NET Server
+-----------------+                +-----------------------------------+
| HTML + htmx.js  | -- HTTP GET -> | FastEndpoints route               |
|                  |                |   -> HtmxComponentEndpoint        |
|                  |                |     -> ComponentHtmlResponseService|
|                  |                |       -> HtmlRenderer (Blazor SSR)|
| <-- HTML frag -- |                |     <- Rendered HTML fragment     |
+-----------------+                +-----------------------------------+

Project Structure

FastComponents/
├── src/
│   └── FastComponents/           # Core library (NuGet package)
│       ├── Components/
│       │   ├── Base/             # HtmxComponentBase, ClassNamesBuilder, interfaces
│       │   └── HtmxTag/         # Generic htmx-aware Razor component
│       ├── Endpoints/            # HtmxComponentEndpoint base classes
│       ├── Services/             # ComponentHtmlResponseService, HtmlBeautifier
│       ├── Utilities/            # Hx helper (swap constants, target helpers)
│       └── wwwroot/              # Bundled htmx.min.js
├── demo/
│   └── HtmxAppServer/           # Demo app (Counter, MovieCharacters examples)
├── docs/                         # Auto-generated API documentation
├── build/                        # Build scripts (versioning)
└── .github/workflows/            # CI pipeline (build, pack, validate, deploy)

Roadmap

  • Implement HTML beautifier for formatted debug output
  • Add AOT compilation support
  • Publish a dotnet new project template
  • Add unit and integration tests
  • Expand component library with common UI patterns

Want to contribute? Pick any roadmap item and open a PR!

Contributing

Contributions are welcome! Please read CONTRIBUTING.md first.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit using conventional commits (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

Apache-2.0 (c) 2020-2026 Atypical Consulting


Built with care by Atypical Consulting -- opinionated, production-grade open source.

Contributors

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.0.0-alpha.0.33 23 2/28/2026
0.0.0-alpha.0.32 28 2/28/2026
0.0.0-alpha.0 237 1/7/2024

This is the first release of FastComponents.
     It is considered as a preview version, so it is not (yet) recommended to use it in production.
     Discover the power of MRA (Multiple Resources Application) with FastComponents.