Skip to content

Declare whether a nested instance's slot is composable #630

Description

@nathanacurtis

Problem

A component's layout can contain an instance whose own slot holds authored content — a Menu placing a Bottom Sheet, with an action list drawn inside it. The schema cannot express whether that nested slot is part of the Menu's composable surface or the Menu's private business. Neither permission nor prohibition can be stated.

The information is not in the design file either. In Figma, composition is direct manipulation: every nested slot is addressable because the designer edits the tree in place, so nothing records that exposure was intended. In code a component is closed — only declared props are reachable. Filling a slot and exposing a slot look identical on canvas and are different acts.

Two consequences, both observed:

  • Menu has no slot prop at all, so the action list a designer drew inside its sheet has nowhere to attach. Recording it would hardcode one designer's content into every Menu with no prop to replace it.
  • Paging Carousel does have a pass-through. Recording the fill replaced it, turning "forward whatever dots you are given" into three fixed dots — even though slot examples are documented as non-contractual reference material.

Potential solution(s)

  • Schema vocabulary for a forwarded slot: a component declares that a named nested instance's slot is part of its own surface.
  • An authoring surface for that declaration. Figma has no native construct meaning "this nested slot is public", so it needs a convention or annotation the author opts into.
  • State emitter precedence: when a slot has both a binding and an example, the binding wins.

Acceptance criteria

  • A spec can state that a nested instance's slot is composable
  • A spec can state that it is not, and that is the default
  • An author can declare it from the design file
  • An example never displaces a live binding in emitted code
  • Capture records nested fills for components once declared

Case data

  • Fixture: Menu, Paging Carousel, Bottom Sheet
  • Workspace: eg — found while adding composition support
  • Territory: schema
  • Size: l

Notes

Capture currently records these fills for compositions only (SlotContent.anchorFillsOnVariantElements), where the arrangement is the deliverable and no API surface conflicts. Components stay silent rather than answering by accident. Recorded in specs-from-figma/RUNTIME_GAPS.md.


Implementation details are tracked internally.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

react-from-specsTransformer from specs into React codeschemaspecs-schema types and JSON schemaspecs-from-figmaTransformer from Figma into specswebcomponents-from-specsTransformer from specs into web components code

Fields

Priority

None yet

Projects

  • Status
    Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions