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.