Need More Info
Last Updated: 24 Nov 2020 10:45 by ADMIN
Created on: 18 Nov 2020 18:00
Category: UI for Blazor
Type: Feature Request
Add Id parameter on all Blazor components

I would like to be able to set the Id on any Blazor component for automated testing purposes.



If you need something different than automated testing selectors, please add your use case in the comments.

For automated testing, you can cascade selectors through a parent element (e.g., a div or span) that has the desired attributes (be that id, class, some data-* attribute, etc.). Adding ID parameters to Blazor components can easily make them brittle because they can be repeated and included in arbitrary hierarchy easily - that's the core concept of a razor component - so such IDs need to be unique, which defeats the predictability you will need for testing.

You can also Follow a separate enhancement for the Grid Command buttons here :


Marin Bratanov
Posted on: 24 Nov 2020 10:45

Hi Hien,

To clarify a couple of things:

We understand the value of such a parameter for automated testing. For the time being, a selector should go through a parent element.

For other use cases (runtime business logic of the app), you should use MVVM (parameters and view-model fields) or component references, but not JS to alter the components.

If you have a different use case than these two, please provide some more details so we can get a better understanding of the situation.

Marin Bratanov
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at

Posted on: 24 Nov 2020 08:57

Dear Admin

We are using a lot of components which are unique. For us it would be much easier to reference them by ID instead via cascading selectors.

Best regards,