Skip to main content
Question

Full width button variant

  • January 16, 2024
  • 8 replies
  • 1738 views

Dennis_Kuiper

Hey all,

I was wondering I want to create a button that has a full width option so it will fill in the frame it has been placed in. Is there a way to achieve this? Can’t seem to figure it out.

This topic has been closed for replies.

8 replies

Raphael_M
  • Power Member
  • January 17, 2024

Hi, Dennis. If you put the button inside a frame with auto-layout, you can set it’s width/height to fill where it will fill all the space.
image

For more information regarding auto-layout, check this tutorial by Figma (albeit, its outdated 😅) https://www.youtube.com/watch?v=TyaGpGDFczw&ab_channel=Figma


Dennis_Kuiper
  • Author
  • New Member
  • January 17, 2024

Hey @Raphael_M thanks for the reply!

Is it possible tho to make a button (component) and give it a variable full width so it will automaticaly make it fill container?


Raphael_M
  • Power Member
  • January 17, 2024

Yes. Add an auto-layout in your component with variants and set all the variants to fill container.

If you paste the instance in a frame with auto layout, it should automatically fill the space.


Dennis_Kuiper
  • Author
  • New Member
  • January 17, 2024

Hey,

The thing is that it doesn’t seem to work consistently for me. I need to manually do a fill for the one with the full width before it uses it correct.


Raphael_M
  • Power Member
  • January 17, 2024

Hi. Have you checked if the frame where you will put the button is on auto layout? Because in my end, it works properly.


Dennis_Kuiper
  • Author
  • New Member
  • January 17, 2024

Yeah the thing is if I drop the component from the left drawer into that frame and change the variation to full width it turns to fixed.


Raphael_M
  • Power Member
  • January 17, 2024

Hi. Will you be able to show me a video example if you don’t mind? Thanks.


Viktor_Wrange

Has anyone found a solution for this? I’m having the same issue.

My Default button variant is set to hug and I want a second Mobile button variant that should be set to fill width. Dragging in the Mobile button variant into an auto-layout with fixed width it works and the button fills the entire width of the auto-layout. But if I first drag in the Default button variant and switch to my Mobile button variant it changes to fixed width and has the same width as my main component.