Skip to content

figma.children() does not descend into intermediate frames to resolve connected instances #372

@micahgodbolt

Description

@micahgodbolt

In slot-based component systems (like Fluent UI), Figma components commonly use intermediate frames as layout containers for React prop slots. figma.children() only resolves direct children of the component, so connected instances nested inside those frames cannot be reached.

Current behavior

Given this structure:

ChatInput (COMPONENT with code connect)
├── Toolbar (FRAME) ← direct child
│ ├── Button ← INSTANCE with Code Connect
│ └── Button ← INSTANCE with Code Connect
└── Button container (FRAME)
└── Button ← INSTANCE with Code Connect
  • figma.children("Toolbar") — passes validation, but renders {} because the frame has no Code Connect
  • figma.children(["Button"])fails validation: The layer does not exist on the Figma component because the instances are grandchildren

Expected behavior

figma.children("Toolbar") should descend into the named frame and render Code Connect snippets for the connected instances inside it, OR a { recursive: true } option should be available to opt into this behavior.

Why this matters

The "wrapper frame as React slot" pattern is standard in design systems. Requiring designers to either remove layout frames or adopt a special "slot component" convention just to satisfy Code Connect creates friction that doesn't scale across a component system. The current behavior makes figma.children() effectively unusable for any component that uses frames for layout.

Workaround

Hardcode static JSX in the example function instead of using figma.children().

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions