How do I get element name from element ID?

I’m wrapping react-tabs to create a new type of tab component that is not limited to 5 tabs. I need to specify the target element for those tabs to change state on. So I have an element-picker in my form. When I pick an element, it returns an elementId value, which is a large integer. What I really want is the name of the element. Is there a method to translate an element ID to an element name somewhere? Thanks.

Regards,
Dave

In addition, the existing, built-in, tabs component allows you to set an ‘element’ to change content or perform an action on in the Interact section of React Builder. I’m using this to pass state from the tab to a component that has multiple states.

Screen Shot 2021-11-11 at 3.29.06 PM

I’d like to be able to do the same thing in my own tabs component, but the ‘in element’ selection is grayed out. The only thing i seem to be able to do is ‘save data’ to a dataslot. What code would i need in my plugin to allow me to use the ‘in element’ selection?

Thanks.

Dave

Hi Dave,

@juha_neonto will provide you an answer to first question. Regarding the second question about passing the state can’t you simply save the state index to a Data slot when user clicks the button? Then just use that Data slot as value for the component’s state.

I’m almost sure that Plugin’s dont have access to Change content interaction. If I recall right the plugins do have access to “Perform action” interaction, check the Camera plugin, it should have interactions e.g. for “Shoo/Take a photot”.

Currently there’s no way to translate element ID to name in plugins.

Probably the best way to achieve your goal is to do what Antti suggested: save a tab index to a data slot and set the target element to change its content based on the data slot value.

Antti,

Sorry for the late response. Saving the index to a data slot worked perfectly. Thanks for your help. I really like this product.

Dave