From 86bbca8f9e48ecbee5332ee4d8c63ffacee7fcd4 Mon Sep 17 00:00:00 2001
From: Alexander Wicht <148378+Ducki@users.noreply.github.com>
Date: Wed, 14 Sep 2022 20:40:27 +0200
Subject: [PATCH] Creates TIP explaining usage of HtmlAttributeName in custom
Tag Helper (#26962)
* Adds note explaining HtmlAttributeName usage
* changes HtmlAttributeName hint to TIP
* Fixes TIP syntax
* removes link to HtmlAttributeName API docs
* Updates
* Update aspnetcore/mvc/views/tag-helpers/authoring.md
* restores f4949b6, moves down and removes TIP markup
Co-authored-by: Luke Latham <1622880+guardrex@users.noreply.github.com>
Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
---
aspnetcore/mvc/views/tag-helpers/authoring.md | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/aspnetcore/mvc/views/tag-helpers/authoring.md b/aspnetcore/mvc/views/tag-helpers/authoring.md
index afa1a4e4f6..336cc504e3 100644
--- a/aspnetcore/mvc/views/tag-helpers/authoring.md
+++ b/aspnetcore/mvc/views/tag-helpers/authoring.md
@@ -117,6 +117,21 @@ That approach works for the attribute "href" as long as it doesn't currently exi
With a self-closing email tag helper, the output would be ``. Self-closing anchor tags are not valid HTML, so you wouldn't want to create one, but you might want to create a tag helper that's self-closing. Tag helpers set the type of the `TagMode` property after reading a tag.
+ You can also map a different attribute name to a property using the [`[HtmlAttributeName]` attribute](xref:Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeNameAttribute).
+
+ To map an attribute named `recipient` to the `MailTo` property:
+
+ ```csharp
+ [HtmlAttributeName("recipient")]
+ public string? MailTo { get; set; }
+ ```
+
+ Tag Helper for the `recipient` attribute:
+
+ ```html
+
+ ```
+
### ProcessAsync
In this section, we'll write an asynchronous email helper.