Link Avatar to a URL

I have an avatar component and I'd really like to make it so that clicking it will redirect to a new URL (to the user's profile URL on a different web app). I've tried using addEventListener() or just assigning avatar1.onclick = () => utils.openUrl("...") but they don't seem to work.
Is there any good way of doing this?

1 Like

Hey Vitaliy - welcome to the forum!
No event handler on avatar components available right now :frowning:

Jonathan

Hi @Vitaliy_Vekslyer

Thanks for reaching out! You'll generally need to use the natively supported event handlers, as opposed to adding your own event code. I will make an internal feature request for this & post here with any updates. Could you work around this limitation by putting the avatar in a container, removing the header of the container, and then adding a click event to the container?

Another workaround could be to create your own "avatar" component with the html component, which does support events

I decided to just include a button that links to the URL,
Would be a great feature to have in the future, thank you all for the help :slight_smile:

1 Like

100% agree. Common behavior would be that if the avatar or name is clicked on, it would go to personal settings or user profile - without it, I can see this actually being worse than not having it at all in terms of UX.

2 Likes

I totally agree Shawn,

I don't use the Avatar at all, as its functionality is so woeful as to be unusable.

If only it would expose a click event...

Hi Tess,

Any luck on getting something done with the Avatar? It could really do with a click event.

It's been a year. The container idea is a great one, with padding and margins turned off.

Thanks,

Stewart

We haven't been able to prioritize this one yet :disappointed: Will post here if I get any updates