diff --git a/plugin-api-standalone.d.ts b/plugin-api-standalone.d.ts index 25772c8..cbc2dfc 100644 --- a/plugin-api-standalone.d.ts +++ b/plugin-api-standalone.d.ts @@ -1082,6 +1082,32 @@ interface PluginAPI { * ``` */ createFrame(): FrameNode + /** + * Note: This API is only available via `use_figma` in the MCP server + * + * Creates a new frame with auto layout already enabled. Both axes default to hug content + * (`primaryAxisSizingMode = "AUTO"`, `counterAxisSizingMode = "AUTO"`), so children can + * immediately use `layoutSizingHorizontal/Vertical = "FILL"` after being appended. + * + * @remarks + * + * Prefer this over `createFrame()` whenever you need an auto-layout parent. Since `layoutMode` is + * already set, children can use `FILL` sizing immediately after being appended. + * + * The default direction is `"HORIZONTAL"`. Pass `"VERTICAL"` for a column layout. + * + * ```ts title="Create an auto-layout frame" + * const row = figma.createAutoLayout() + * const column = figma.createAutoLayout("VERTICAL") + * + * row.itemSpacing = 16 + * row.paddingTop = 24 + * row.paddingBottom = 24 + * row.paddingLeft = 24 + * row.paddingRight = 24 + * ``` + */ + createAutoLayout(direction?: 'HORIZONTAL' | 'VERTICAL'): FrameNode /** * Note: This API is only available in Figma Design * diff --git a/plugin-api.d.ts b/plugin-api.d.ts index f0c6fc6..d546796 100644 --- a/plugin-api.d.ts +++ b/plugin-api.d.ts @@ -1078,6 +1078,32 @@ interface PluginAPI { * ``` */ createFrame(): FrameNode + /** + * Note: This API is only available via `use_figma` in the MCP server + * + * Creates a new frame with auto layout already enabled. Both axes default to hug content + * (`primaryAxisSizingMode = "AUTO"`, `counterAxisSizingMode = "AUTO"`), so children can + * immediately use `layoutSizingHorizontal/Vertical = "FILL"` after being appended. + * + * @remarks + * + * Prefer this over `createFrame()` whenever you need an auto-layout parent. Since `layoutMode` is + * already set, children can use `FILL` sizing immediately after being appended. + * + * The default direction is `"HORIZONTAL"`. Pass `"VERTICAL"` for a column layout. + * + * ```ts title="Create an auto-layout frame" + * const row = figma.createAutoLayout() + * const column = figma.createAutoLayout("VERTICAL") + * + * row.itemSpacing = 16 + * row.paddingTop = 24 + * row.paddingBottom = 24 + * row.paddingLeft = 24 + * row.paddingRight = 24 + * ``` + */ + createAutoLayout(direction?: 'HORIZONTAL' | 'VERTICAL'): FrameNode /** * Note: This API is only available in Figma Design *