KendoButton & ref

1 Answer 156 Views
Button Popup
Vladislav
Top achievements
Rank 2
Iron
Iron
Vladislav asked on 03 Nov 2023, 02:44 PM | edited on 07 Nov 2023, 09:17 AM

Hello!

Is it possible to use a reference for KendoButton? I have a KendoPopup where I need to assign ref.current to the props anchor. But it doesn't work. .current is always undefinedIt works with basic HTML components like div, span, button. I followed the DEMO: https://www.telerik.com/kendo-react-ui/components/popup/. But I need to use KendoButton. Is that possible? With functional components?

I know that I can use, for example, span, div as a child, or as an element near a KendoButton. However, I am interested in a cleaner way.

Well thank you.

1 Answer, 1 is accepted

Sort by
0
Wissam
Telerik team
answered on 07 Nov 2023, 11:24 AM

Hello, Vladislav,

The Popup anchor tag takes the button's element as a value.

For the KendoReact Button, the element is available through `ref.current._element`. In addition, it should be checked if `ref.current` is defined before setting the anchor property to the button's element.

For convenience, I prepared an example where the KendoReact Button is used instead of the HTML button with the Popup:

I hope this helps, but please let me know if you have any further questions.

Regards,
Wissam
Progress Telerik

Stay tuned by visiting our public roadmap and feedback portal pages! Or perhaps, if you are new to our Kendo family, check out our getting started resources!

Tags
Button Popup
Asked by
Vladislav
Top achievements
Rank 2
Iron
Iron
Answers by
Wissam
Telerik team
Share this question
or