dotnet / dotnet/AspNetCore.Docs
Documentation for Tag Helper Components lacks important information
- Dominant language
- C#
- Stars
- 13.1k
- Forks
- 24.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 109
Description
### Description
The documentation doesn't provide information about how Tag Helper Components relate and/or interact with regular Tag Helpers. For example, does `Order` property affect how a tag helper component is executed in relation to regular tag helpers? And what is the purpose of the `ITagHelperComponentManager`? And why are there the `TagHelperComponentTagHelper` and `TagHelperComponent` classes? How they differ, and when should I use one over another?
I'm trying to understand how this works for my specific use case, and I can't find enough information in the documentation that can be of any help.
In my use case, I have a tag helper (inheriting from `TagHelper`) that targets `` elements and generates some input fields. Those input fields then need to be styled with some generated CSS that is specific to each field, so my tag helper stores data about those fields in the `HttpContext`. I have a tag helper component (inheriting from `TagHelperComponent`) that I register as a service, and which is responsible for generating the proper `` tag in the `<head>` for styling the fields generated by the tag helper in the form. So, I need my tag helper component to always run after my form's tag helper. In my testing, it always does, for this use case, but I have no documentation that tells me why or that offers any guarantees that this is the behavior I should always expect.
I suggest that the documentation for this gets improved, so questions like mine would be answered by it. I had to look at the source code to try to get the answer, but because tag helpers and tag components have many moving parts, I could not find a proper answer there, unless I dedicate quite some time looking through it. And still, because this doesn't seem to be documented, I'm not sure if I can rely on the implementation,
### Page URL
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/tag-helpers/th-components?view=aspnetcore-8.0
### Content source URL
https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/mvc/views/tag-helpers/th-components.md
### Document ID
069ef9fd-61c2-2c65-d0fe-60d272723f03
### Article author
@Rick-Anderson
Contributor guide
Assessment
This issue has not been assessed yet.