Skip to main content
Solved

How to Create a Shape-Based Button That Expands with Text?

  • February 4, 2025
  • 2 replies
  • 123 views

SuzyG

I know how to create a standard button in Figma where you use a stroke around the text to make it expandable, but I'm having trouble with a custom shape button. Specifically, I want to create a button using a custom shape (like an ellipse) that will resize based on the text length.

I want the text and button to expand together, so the button adjusts automatically if the text changes or is longer. Is there a way to achieve this with Auto Layout, or is there a better approach for this kind of dynamic resizing with custom shapes?

Any help would be greatly appreciated!

Image 1 is my button
Image 2 is what currently happens if the text is longer  than the button

 

Best answer by nikitapashinsky

 Hi! You can do achieve a similar effect by using a combination of Auto layout and absolute positioning (“Ignore auto layout” button in the top right corner of the Position panel):

 

https://www.figma.com/design/02zyqmdHbNV4aWRS3ArwxZ/Untitled?node-id=0-1&t=yr7BhL5TGUHW1hor-1
Set the desired paddings on the button, then add the ellipse

 

An ellipse set to ignore auto layout and manually stretched to occupy full width and height of the button

 

Constraints set to stretch horizontally and vertically (scale also works)

 

 

View original

2 replies

nikitapashinsky

 Hi! You can do achieve a similar effect by using a combination of Auto layout and absolute positioning (“Ignore auto layout” button in the top right corner of the Position panel):

 

https://www.figma.com/design/02zyqmdHbNV4aWRS3ArwxZ/Untitled?node-id=0-1&t=yr7BhL5TGUHW1hor-1
Set the desired paddings on the button, then add the ellipse

 

An ellipse set to ignore auto layout and manually stretched to occupy full width and height of the button

 

Constraints set to stretch horizontally and vertically (scale also works)

 

 


SuzyG
  • Author
  • New Member
  • 1 reply
  • February 25, 2025

That worked great! Thank you so much for your help! 


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings