FluentHtmlBuilder 1.0.2

dotnet add package FluentHtmlBuilder --version 1.0.2
                    
NuGet\Install-Package FluentHtmlBuilder -Version 1.0.2
                    
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="FluentHtmlBuilder" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="FluentHtmlBuilder" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="FluentHtmlBuilder" />
                    
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 FluentHtmlBuilder --version 1.0.2
                    
#r "nuget: FluentHtmlBuilder, 1.0.2"
                    
#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.
#addin nuget:?package=FluentHtmlBuilder&version=1.0.2
                    
Install FluentHtmlBuilder as a Cake Addin
#tool nuget:?package=FluentHtmlBuilder&version=1.0.2
                    
Install FluentHtmlBuilder as a Cake Tool

HtmlBuilder

A lightweight and extensible HTML element builder for .NET developers. Designed with clean and fluent syntax for composing HTML elements dynamically in C# with full support for nesting, attributes, and rendering.


โœจ Features

  • Dynamic creation of HTML elements via fluent C# API
  • Full support for nesting, attributes, and inner content
  • Ideal for building reusable HTML components
  • Easily extendable with custom rendering logic
  • Built with SOLID principles and DDD mindset

๐Ÿ“ฆ Installation

Install the NuGet package:

dotnet add package HtmlBuilder

Or via the NuGet Package Manager:

Install-Package HtmlBuilder

๐Ÿš€ Quick Start

var div = HtmlBuilder.Div(div =>
        {
            div.Div(x => x.H1(h1 =>
            {
                h1.SetContent("Hello - World")
                    .SetId("id")
                    .AddClass("col-md-4");

            }))
            .Div(x => x.H2(h2 =>
            {
                h2.SetContent("GoodBye - World")
                    .SetId("id")
                    .AddClass("col-md-3");
            }));
        });
string html = div.ToPrettyHtml();
Console.WriteLine(html);

Output:

<div>
  <div>
    <h1 id="id">Hello - World</h1>
  </div>
  <div>
    <h2 id="id">GoodBye - World</h2>
  </div>
</div>

๐Ÿ“ Project Structure

HtmlBuilder/
โ”œโ”€โ”€ src/HtmlBuilder/           # Core library
โ”œโ”€โ”€ tests/HtmlBuilder.Tests/   # Unit tests using xUnit
โ”œโ”€โ”€ HtmlBuilder.sln            # Solution file
โ””โ”€โ”€ README.md                  # This file

๐Ÿงช Running Tests

dotnet test

๐Ÿ“š Documentation

Coming soon โ€” advanced usage and extension patterns will be documented in the Wiki.

๐Ÿค Contributing

Contributions are welcome! Feel free to submit issues or pull requests. For major changes, please open an issue first to discuss what you would like to change.

๐Ÿ“„ License

MIT License

Copyright (c) 2025 DaniyalAsadi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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

    • No dependencies.

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
1.0.2 115 5/21/2025
1.0.1 192 5/14/2025