Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation for Tag Helper Components lacks important information #33605

Open
AderitoSilva opened this issue Sep 14, 2024 · 0 comments
Open
Assignees
Labels
aspnet-core/svc mvc/subsvc Pri3 Source - Docs.ms Docs Customer feedback via GitHub Issue

Comments

@AderitoSilva
Copy link

AderitoSilva commented Sep 14, 2024

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 <form> 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 <style> 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aspnet-core/svc mvc/subsvc Pri3 Source - Docs.ms Docs Customer feedback via GitHub Issue
Projects
None yet
Development

No branches or pull requests

4 participants