liveBook · Manning

TagHelper

As explained in ASP.NET Core in Action, 3e

TagHelper is the ASP.NET Core base class from which custom Tag Helper components derive.

TagHelper is the ASP.NET Core base class for custom Tag Helper components. Derive a class from it and override Process or ProcessAsync to describe how the component renders itself. section 32.1.1

System information element

A class named SystemInfoTagHelper is invoked from Razor with <system-info>. By convention, the class name loses the TagHelper suffix and becomes kebab-case. The component can render a div, expose boolean attributes such as add-machine and add-os, and HTML-encode output before writing it to the page. section 32.1.1

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains derivation, naming, attributes, encoding, and Process rendering, but stops short of broader component architecture.
Examples
Uses SystemInfoTagHelper, system-info markup, machine and operating-system attributes, and a layout footer.
What it assumes
Assumes familiarity with Razor templates and HTML, while demonstrating custom component structure from the base class upward.
What you can do after
Build it from scratch as a custom Razor Tag Helper that renders configurable, encoded HTML.
How it connects
Connects TagHelper with Razor templates, HTML attributes, dependency injection, HTML encoding, and cross-site scripting prevention.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.