Figma Support Forum

Can anyone help with this interactive tab bar?

Hi community members!
I’m trying to create a component for my interactive tab bar, in which the “highlighter” moves from title to title as the user clicks on it.

I’ve used auto layout for the titles and set the highlighter behind it so it would relocate when clicking on one of the titles.
the problem is - as soon as i make it a component I can still change the text in it but not the highlighter size to fit the text width (It’s going to get used in several areas in my design so the titles will change)
anyone has a solution for me?
adding couple more photos to illustrate my problem:

Thanks for the helpers!