Class HtmxScriptsTagHelper
- Namespace
- Htmx.Components.TagHelpers
- Assembly
- Htmx.Components.dll
Tag helper that includes all Htmx.Components JavaScript behaviors as inline scripts. This replaces the need to include individual JavaScript files and allows for dynamic content generation.
[HtmlTargetElement("htmx-scripts")]
public class HtmxScriptsTagHelper : TagHelper, ITagHelper, ITagHelperComponent
- Inheritance
-
HtmxScriptsTagHelper
- Implements
- Inherited Members
- Extension Methods
Constructors
HtmxScriptsTagHelper(IHtmlHelper, IWebHostEnvironment)
Initializes a new instance of the HtmxScriptsTagHelper with the required dependencies.
public HtmxScriptsTagHelper(IHtmlHelper htmlHelper, IWebHostEnvironment environment)
Parameters
htmlHelper
IHtmlHelperThe HTML helper for rendering HTML content
environment
IWebHostEnvironmentThe web hosting environment for accessing application information
Properties
Exclude
Gets or sets which scripts to exclude from the default set. Valid values: "page-state-headers", "table-inline-editing", "blur-save-coordination", "authentication-retry"
public string? Exclude { get; set; }
Property Value
Include
Gets or sets which scripts to include. If null or empty, includes all scripts. Valid values: "page-state-headers", "table-inline-editing", "blur-save-coordination", "authentication-retry"
public string? Include { get; set; }
Property Value
ViewContext
ViewContext is required to contextualize the IHtmlHelper
[ViewContext]
[HtmlAttributeNotBound]
public ViewContext ViewContext { get; set; }
Property Value
Methods
ProcessAsync(TagHelperContext, TagHelperOutput)
Processes the tag helper and renders the requested JavaScript behaviors.
public override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
Parameters
context
TagHelperContextoutput
TagHelperOutput