FluentHtml

Build HTML in .NET, not strings.

FluentHtml is a FastHTML-inspired microframework for ASP.NET Core that enables developers to build modern server-rendered web applications using a fluent API — most natural from C#, but usable from any .NET language.

Packages

Package Description
FluentHtml.Core Core HTML elements, Node hierarchy, Components, Rendering
FluentHtml.Http HTTP layer integration
FluentHtml.Htmx HTMX attribute extensions
FluentHtml.Bootstrap Bootstrap components and CSS helpers
FluentHtml.Forms Strongly-typed form helpers
FluentHtml.Validation Validation components

Example

using FluentHtml;
using FluentHtml.Elements;
using FluentHtml.Bootstrap.Components;
using FluentHtml.Htmx;

var page = Div()
    .Class("container")
    .Children(
        H1("Welcome to FluentHtml"),
        P("Build HTML in .NET, not strings."),
        Btn("Click Me")
            .Primary()
            .Large()
            .HxPost("/api/click")
            .HxTarget("#result")
    );