Skip to content

Instantly share code, notes, and snippets.

@kemiljk
Last active October 14, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kemiljk/0932469ee92adb09b789e36f4bc8ace8 to your computer and use it in GitHub Desktop.
Save kemiljk/0932469ee92adb09b789e36f4bc8ace8 to your computer and use it in GitHub Desktop.
Scripter: Add Auto Layout to all of your individually selected Frames
const { selection } = figma.currentPage;
const direction = "VERTICAL" // "HORIZONTAL"
const spacing = 24 // any number
const padding = 24 // any number
const vAlignment = "CENTER" // "MIN" (left) or "MAX" (right)
const hAlignment = "SPACE_BETWEEN" // "MIN" (top), "MAX" (bottom), "SPACE_BETWEEN" (stretch)
selection.forEach((node: FrameNode) => {
node.layoutMode = direction
node.itemSpacing = spacing
node.counterAxisAlignItems = vAlignment
node.primaryAxisAlignItems = hAlignment
node.paddingTop = padding
node.paddingBottom = padding
node.paddingLeft = padding
node.paddingRight = padding
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment