This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Chris Bindloss
Posted Mar 10 - Read on Facebook

I'm trying to make a reusable toast component (using the symbols moldule) where the container width adapts to the length of the text layer within it. Anyone know how I might do that?


Rafael Marin

You can use the scrollWidth property of the DOM element to get the width of its content. So if your text layer name is myLayer, you'd get that measure through myLayer._element.scrollWidth

Chris Bindloss

How does that differ from using textLayer.width? My question was more about how to set up an event listener in the Events object passed into the symbol

Lukas Guschlbauer

Hey! I‘m gonna look into this today and hopefully get it working in the module!

Jacky Lee

Hey Chris I made a module for this earlier:

To answer your specific question: I gave the textLayer a background color and some padding, that should solve the adaptable background width issue you had.

Read the entire post on Facebook