Auto layout is a powerful tool in Motiff. You can use Auto layout to complete your design work efficiently.
There are many common design scenarios where auto layout can be used, such as:
For auto layout, the following features cannot be used simultaneously:
🚫 Constraints cannot be applied to the child layers of an auto layout frame, unless the layers have absolute position enabled. Learn more about Constraints.
🚫 Smart selection cannot be used on the child layers of an auto layout frame.
Auto layout is a property of a frame. Learn more about Frame.
You can add auto layout to a frame, components, or other selected layers. This includes:
Note: If the selected layers are not in a frame, Motiff will create an auto-layout frame around them.
There are three ways to add auto layout to a selected frame or layer:
Tip: You cannot add multiple auto layouts by selecting multiple frames. You need to add auto layout to each frame individually.
Any layer can be added to the auto layout.
Note: If the size of the layer being dragged is larger than the auto layout frame, you will not be able to see the blue indicator line prompt for adding it to the auto layout.
If you want to drag it in, hold down the modifier key while dragging:
In auto layout, you can duplicate child layers. Motiff will automatically add a copy to the right (for horizontal arrangement) or below (for vertical arrangement) of the original layer:
You can change the order of child layers in auto layout:
You can delete child layers from the auto layout frame in the following three ways:
Tip: Auto layout ignores hidden child layers. If you want to create a gap where the child layer is located, you can change its opacity to 0%.
You can delete auto layout, and the auto layout frame will revert to a regular frame.
There are three ways to delete auto layout:
Select the auto layout frame and click next to the auto layout in the right sidebar.
Right-click the auto layout frame and choose to delete auto layout.
Select the auto layout frame and use the shortcut keys:
Tip: You cannot use Add auto layout shortcut key to remove the auto layout property. If you use this shortcut key again, Motiff will create a new auto layout frame around your current selection.
Direction refers to the arrangement direction of child layers within the auto layout frame.
Each auto layout can only set one direction. If you want to build multiple directions, nesting is required.
You can adjust the arrangement of child layer spacing within the frame by setting the spacing type.
The following methods can adjust the spacing of auto layout in the canvas area:
Tip: Hold Shift while dragging the handle for adjustments of 10px at a time.
The following methods can adjust the spacing of auto layout in the right sidebar:
When the auto layout frame’s direction is set to Vertical or Horizontal, you can set the horizontal and vertical gap between items respectively. When the frame’s direction set to Wrap, then you can set both horizontal and vertical gap between items.
Padding refers to the distance between the boundaries of the auto layout frame and its child layers.
You can set the padding uniformly in the vertical or horizontal direction or have different values for the top, bottom, left, and right padding separately.
Padding can be adjusted through the canvas or the right sidebar.
The following methods can adjust the auto layout's padding in the canvas area:
The following shortcuts can be used to adjust multiple paddings simultaneously:
macOS | Windows | |
---|---|---|
Adjust opposing paddings simultaneously | Hold⌥ Option | Hold Alt |
Adjust all paddings simultaneously | Hold⇧ Shift + ⌥ Option | HoldAlt + Shift |
Tip: When the input box in the canvas area appears, you can press Tab key to switch the padding controlled by the input box.
In the right sidebar, you can adjust the vertical (top and bottom) and horizontal (left and right) paddings separately.
If you want to set different paddings for all sides, click in the right sidebar and set different numeric values for the paddings of each side.
You can set the alignment of child layers on the auto layout frame, but you cannot control the alignment of individual child layers individually.
The direction and spacing type of the auto layout frame determines the alignment options you can use.
In the right sidebar, you can adjust the alignment through interactive illustrations.
When the gap between items is set to Auto, you have only three alignment options for each direction:
The auto layout frame can responsively resize based on the size/number of child layers. Child layers can also responsively resize based on the size change of the frame.
You can control how the frame and child layers adjust their size through response types.
Adjust response types in the design panel in the right sidebar. There are three types of response: Hug contents, Fill frame, and Fixed. The response types for width and height needs to be set separately.
Hug contents: You can set the auto layout frame to Hug contents. After setting, the size of the frame will change according to the number/size of child layers. Under the premise of retaining spacing and padding, the frame will minimize its size to wrap around the child layers.
Tip: Double-clicking the frame's bounding box can set it to Hug contents.
Fill Frame: You can set the auto layout child layer to Fill frame. After setting, the size of the child layer will change according to the size of the frame. Under the premise of retaining spacing and paddings, the child layer will stretch to fill the remaining space inside the frame.
Tip: Hold ⌥ Option and double-click the edit box can set the child layer to fill the frame.
Fixed: You can set the auto layout frame or auto layout child layer to Fixed. After setting, the layer will no longer responsively adjust its size based on the frame or based on the changes in child layers.
Note: In the response type, if a child layer is set to Fill frame, the frame will not maintain Hug contents and will become fixed.
Minimum and maximum dimensions
You can set minimum or maximum width and height to any auto layout frame and its child layers.
If a layer contains a min or max setting, its width or height icon will have two lines that are positioned on either side. You can hover over these icons to preview the limits on canvas.
To remove a min or max setting, open the Width or Height dropdown and choose Remove min/max width/height.
The covering method for overlapping layers can switch the order of child layers when they overlap.
When multiple child layers overlap, the one arranged after is on top by default.
You can change the visual order of the overlaps that are visible on the canvas.
After selecting the auto layout frame, click to open more settings and make a selection:
Note: Modifying the covering method of overlapping layers will not affect the order of layers in the layer list.
Setting text baseline alignment can adjust the alignment relationship between text and other text or text and other layers.
When content is arranged horizontally, the alignment options support selecting Text baseline alignment.
Next to the alignment options, you can click to open more settings and click next to text baseline alignment to enable baseline alignment.
Absolute position allows child layers to be precisely placed on their parent layer without being controlled by auto layout rules, while still staying inside the auto layout frame in the layer list.
To enable absolute position, select the child layer of the auto layout frame, then click in the right sidebar.
Tip: Child layers with absolute position can be seen as child layers within a regular frame and can normally use the constraints function.
The operation of auto layout is convenient, but its powerful feature goes far beyond that. You can explore the complex applications of auto layout through the following usage scenarios.
You cannot apply constraints to child layers of an auto layout frame unless that object has enabled absolute position. Instead, you can use response types to define how layers respond to frame resizing.
You can nest a horizontal auto layout within a vertical auto layout to build more complex responsive interfaces.
In the example, a responsive card is made through a three-layer auto layout nesting structure:
You can nest auto layout in the following ways:
Tip: When multiple frames are nested, the auto layout will only affect the upper parent layer, so you do not need to worry about the component settings in the child layers being affected by the outer frame.
Components themselves are frames, and you can add auto layout to components.
You cannot add multiple auto layouts by selecting multiple components. Instead, you need to select each frame and add auto layout separately.
The following table shows the features of auto layout in terms of components and instances:
Feature | Component | Instance |
---|---|---|
Add auto layout | ✅ | ❌ |
Add child layers | ✅ | ❌ |
Reorder child layers | ✅ | ❌ |
Remove child layers | ✅ | Hides layer only |
Delete auto layout | ✅ | ❌ |
Adjust direction | ✅ | ❌ |
Adjust spacing | ✅ | ✅ |
Adjust padding | ✅ | ✅ |
Adjust alignment | ✅ | ✅ |
Adjust response type | ✅ | ✅ |
Adjust spacing type | ✅ | ✅ |
Adjust canvas stacking | ✅ | ✅ |
Align text baseline | ✅ | ✅ |
Adjust absolute position | ✅ | ✅ |