Skip to content

Anatomy

The Anatomy is a map of named elements that make up a component’s structure. Each entry describes what kind of element it is and, optionally, where it was detected and what component it is an instance of.

type Anatomy = Record<string, AnatomyElement>;

AnatomyElement

PropertyTypeRequiredDescription
typeElementType | ElementTypeRefYesWhat kind of element this is
detectedInstringNoFrame or node name where this element was found
instanceOfstring | SubcomponentRefNoComponent name this element is an instance of, or a $ref to a subcomponent
roleRoleConceptName | RoleConceptName[]NoBehavior concept(s) this element carries, read from role: annotation lines when settings.spec.roles is on — see Roles
actionsActionEntry[]NoBehavior actions ({ type }) read from action: annotation lines, deduped in annotation order — see Actions
$extensionsAnatomyElementExtensionsNoVendor extensions; com.figma carries extraction provenance

AnatomyElementExtensions

Only the com.figma extension is defined.

PropertyTypeDescription
namestringThe element’s Figma layer name, present only when the anatomy key cannot reconstruct it — either after wrapper collapse or when the name falls outside the safe key grammar (see Key Formatting)
childRoleRoleConceptName | RoleConceptName[]A role annotated on the layer wrapper collapse folded into this element, rather than on the element itself. role means the component node carried it, childRole the collapsed child, both present means both did. Only role reaches generated code

ElementType

One of 11 string literals:

TypeDescription
textText content
glyphIcon or symbol
vectorVector shape
containerLayout container (frame, group)
slotInsertion point for child content
instanceComponent instance
lineLine element
ellipseEllipse/circle
rectangleRectangle
polygonPolygon
starStar shape

ElementTypeRef

A URI reference to an externally defined element type:

type ElementTypeRef = { $ref: string };
// e.g. { $ref: "foundations#/definitions/glyph" }

SubcomponentRef

A JSON Pointer linking to a subcomponent defined in the same spec:

type SubcomponentRef = { $ref: string };
// e.g. { $ref: "#/subcomponents/formLabel" }

Within variants, each element’s runtime properties (children, styles, content) are described by the Element type. The element tree can also be expressed as a recursive Layout.

Further Reading