Can I self-reference the component to get the name?

Hello,

For example, I have a "Text Input"-component. I called this component for example "my_component". Is there some way to then get the default value to be "my_component"?

E.g. something like {{component.id}}?

Best regards
Ax

Hi @axe! Thanks for reaching out. Can you try {{self.id}}?

Hi @Tess ,
Thanks for the quick reply! That sounds exactly like what I need! :smiley:

However when trying it I get a type error:
"Error
The value has to be of type 'string | number' you provided a value of type 'undefined'"

image

Can I recast the type 'undefined' as string (as it can see that something is there) or is there any other solution?

Best regards
Axel

Hi @axe! Which version of Retool are you on? The version info can be found by clicking on the chat icon in the lower right corner of your screen. A menu should pop up which will show your Retool version number:

We are using 2.70.21, is this added in the latest releases?

I'll update and see if it solves it. Thanks :slight_smile:

Hi @axe! It actually just came out in 2.80--https://docs.retool.com/docs/retool-v280-release-notes

Let us know if you're still blocked after upgrading

1 Like