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?
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
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
Hey! I‘m gonna look into this today and hopefully get it working in the module!
Hey Chris I made a module for this earlier: https://github.com/aboutjax/Framer-Feedback
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.