Skip to content

Component

The Component type is the root object of every spec. It contains the component’s structure, properties, default appearance, and variant overrides.

Properties

PropertyTypeRequiredDescription
titlestringYesComponent name
anatomyAnatomyYesMap of named elements that make up the component
propsPropsNoConfigurable input properties
defaultVariantYesDefault variant — the baseline appearance
variantsVariant[]NoLayered variant overrides
invalidPropCombinationsPropConfigurations[]NoProp combinations that are not valid together
subcomponentsSubcomponentsNoEmbedded child component definitions
metadataMetadataNoGeneration metadata (author, schema version, config)
instanceExamplesInstanceExamplesNoPro. Documented whole-component usage examples (emitted only with a Pro license)
slotContentExamplesRecord<string, SlotContent>NoPro. Named slot-content fills, referenced by SlotContentRef from slot bindings and from Element.propConfigurations slot-prop entries
imagesRecord<string, ImageData>NoRegistry of image data keyed by id, referenced by Styles.backgroundImage, and by examples and default on ImageBinding and ImageProp. Each entry carries the Figma identity in $extensions['com.figma'].imageHash; resolution adds src (asset path, data: URI, or URL) without replacing it. Emitted when figma.images is configured

Examples and composed content

Several optional fields document configured and composed usages of a component. Each has its own page:

  • InstanceExamples — pre-configured whole-component usages.
  • SlotContent — the anatomy + elements + layout triplet used as a named slot fill, stored in slotContentExamples.
  • SlotContentRef — the $slotContent pointer that references a fill.
  • Composition — a named, authored unit of composed content (system-scoped, external composition files).
  • Children — an element’s children, including slot bindings that carry example fills.

Concern documents

A run with spec.splitConcerns writes one file per concern rather than a single component file. Each file has its own type, requiring what its concern carries and permitting nothing else — a variants.yaml cannot hold an anatomy, and an api.yaml cannot hold a default block.

DocumentFileRequiredAlso carries
SpecApiDocumentapi.yamlmetadata, title, anatomy, propsinvalidPropCombinations, subcomponents
SpecVariantsDocumentvariants.yamlmetadata, default, variantssubcomponents
SpecExamplesDocumentexamples.yamlmetadataslotContentExamples, instanceExamples, images, subcomponents

Each document’s metadata must state its concern — api, variants or examples. That is what identifies the file, and what tells the three apart. A whole Component carries no concern at all.

A nested subcomponent is sliced by the same concern as the document holding it, so each document’s subcomponents uses its own subcomponent shape — SpecApiSubcomponent, SpecVariantsSubcomponent, SpecExamplesSubcomponent.

SpecConcernDocument is the union of the three. TypeScript cannot narrow it on metadata.concern, since the discriminant sits one level down; narrow on a key instead ('title' in doc).