Dec 11, 2022
Baseline #11 – The Easy Way to Build Responsive Components
The one adjustment that really can make a difference!
Auto Layout
When it comes to building components in Figma, either for yourself or your team, it’s often necessary that those components work well within various situations and for different screen widths. This requirement usually leads to either applying constraints to many layers or adding Auto Layout (SHIFT + A
), and this layout property can be applied to frames within a design.
However, for many designers, including myself, Auto Layout can sometimes feel intimidating, especially if you’re new to Figma’s feature. Applying the property usually isn’t enough to make the design responsive, as it’s almost always required to make adjustments to achieve the needed layout and responsive behavior. In my first few years of using Auto Layout within Figma, I remember the process of using the advanced layout tool to feel challenging, and to be honest, the thought of needing to do this for years to come for every design felt daunting.
Overwhelmed and nervous, I set out to find ways to improve my workflows to make Auto Layout more accessible and perhaps even something I would look forward to relying on as I designed. I’d love to share the technique that ended up helping me the most with you!
Applying Auto Layout: the old way 😞
As I think back, I remember feeling so challenged when using Auto Layout—building a component on the canvas to look as it should, Applying Auto Layout, and watching it break when used in an actual design. Does this sound familiar to you? My workflow would look like this:
Step 1: Design and create a component
For me, the first step was always to create the interface I needed and turn it into a component (CMD + OPT + K
), readying the design for either myself or another coworker to use within a design.
Step 2: Add Auto Layout and make adjustments
Knowing that the interface, in this case, a TableRow Cell from iOS, needed to be responsive with the device, I’d add Auto Layout. Content within the component would often shift around during this step. However, after a bit of tinkering, I was generally able to select the correct settings to get the component to look as expected.
Step 3: Use an instance
Next, I finally felt ready to use an instance of the component I had just created! Except, this is where things would break as soon as I added in the appropriate content or adjusted its size. In this case, I would have expected the content to remain centered within the container, regardless of the height, for the text to fill the container, and for the label and caret to always remain at the right-most side.
This quickly led to step 4: overwhelm.
Applying Auto Layout: the new way ✨
When I think about my original way of applying and working with Auto Layout compared to my approach today, there’s one critically different thing: the order in which I begin to test the results of applying Auto Layout.
I’d previously waited until the very end to see if the component’s layer structure and Auto Layout settings were working correctly, and if not, I felt like I needed to go back to square one to start over. With my approach today, I first like to drag out an unfinished component instance and stretch it in bizarre and unexpected ways to see what happens. If I can make this component work as expected in the strangest sizes, I’ll feel confident that it’ll work for nearly all situations. To highlight all of this a bit more, here’s how that approach looks:
Step 1: Without finishing the design, create a component
Thinking back to the TableView Cell component, I’ll first create the frame, maybe adding a piece or two of content, and then almost immediately make a component (CMD + OPT + K
) out of the unfinished design.
Step 2: Create an instance of the unfinished component
With that component created, the next step I’ll take is to make an instance from the unfinished component, which can be done by holding OPT
and dragging.
Step 3: stretch and resize the component
This next step made it all click for me: adjust the sizing of the unfinished instance to see what’s working and, more importantly, what’s breaking. I now have this brand new point of reference as I adjust the original component, and I can immediately see how my Auto Layout-specific settings impact the instance. For me, this point of instant visual feedback has been so helpful!
Step 4: Add remaining content and make adjustments
Finally, it’s time to add the remaining content as you continue to make adjustments. In this case, I’ll add the title, description, label, and chevron while making changes to the sizing and alignment properties that Auto Layout allows. As I go, I still have this point of reference to look at, and because the instance has resized substantially, I know if the changes I’m making result in the correct visual layouts!
A Small Change that Works
This approach may seem like such a tiny change when reading about it, and really, that’s because it is! By simply modifying the order in which I build components and use layout settings, I can more clearly understand the controls and settings within Auto Layout, and I know that the component will work well for anyone who uses it within a design of their own.
Does this method work for you, or do you have other Auto Layout tips? I’d love to know!