Skip to content

simple wrapper for System.Web.Mvc.TagBuilder for implementing complex html structure

Notifications You must be signed in to change notification settings

miket-dev/tagbuilder-ext

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Extended Fluent Tag Builder

This project present wrapper for System.Web.Mvc.TagBuilder for implementing complex html structure.

Repository contains source code for extended version of tag builder and simple tests. ##Sample Usage

var htmlFactory = new HtmlFactory();
htmlFactory.Add("div")
	.Style("display", "block")
	.Class("base-item")
	.Inner(elements =>
	{
		elements.Add("span")
			.Class("header")
			.Text("Header");
		elements.Add("div")
			.Class("subheader")
			.Inner(inner =>
			{
				inner.Add("span")
					.Class("subheader-content")
					.Text("SubHeader");
			});
	});
	
var result = htmlFactory.ToString();

This code will produce a following result:

<div class="base-item" style="display:block;">
	<span class="header">Header</span>
	<div class="subheader">
		<span class="subheader-content">SubHeader</span>
	</div>
</div>

About

simple wrapper for System.Web.Mvc.TagBuilder for implementing complex html structure

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages