How to know which component a rendered HTML element belongs
I think there should be a way to learn the type of the 'originating' component from inspecting DOM using the browser dev tools.
+1 for this i'd be good especially when debugging and applying global css to specific components. Maybe convert the class name of the component to a lisp-case tag? Something along the lines of NavMenu => nav-menu.
Maybe convert the class name of the component to a lisp-case tag
The component itself doesn't appear in the DOM. The only things that go in the DOM are the HTML elements that the component renders. So I'm not sure where we'd put the component name. Our goal is to let you control the rendered DOM exactly, so we shouldn't be adding extra elements or attributes unless you explicitly tell us to, and specify where they should go, by putting them in your Razor markup. Of course you can already put custom attributes like data-componentname="MyComponent" on elements produced by your components if you want to use that in CSS selectors.
I think this is something we'll have to consider as time goes on and we find out how many people are looking for something like this.
I'll close this for now as I'm unsure what a useful design would be. We'll watch out for others requesting similar things in the future. Hope that's OK!
This is fine. I did not realize that using custom attributes was already a possibility. Great work btw