Skip to content

Subcomponents

Subcomponent organization and naming. A library fact, declared in config/conventions.yaml: where a library keeps its subcomponents and how it names them are properties of the library, and a wrong declaration leaves subcomponents undiscovered. When present, the block enables subcomponent detection. When absent, the library declares no subcomponent convention and none are detected.

Configuration

figma:
subcomponents:
scope: PAGE
match:
- '{C} / {S}'
- '{C} / _ / {S}'
exclude:
- '{C} / Examples / {S}'

Result

Matched assets are harvested into a subcomponents registry on the component. Below is a narrow slice of the DS Alert output: the DS Alert / Actions subcomponent, discovered via a {C} / {S} pattern.

{
"title": "DS Alert",
"subcomponents": {
"actions": {
"title": "DS Alert / Actions",
"anatomy": {
"root": { "type": "container" },
"children": { "type": "slot" }
},
"props": {
"children": { "type": "slot" }
}
}
}
}

Without subcomponents, the registry is absent and these nested components are not detected.

Properties

PropertyTypeRequiredDefaultDescription
scope"NESTED" | "PAGE"NoNESTEDWhere the library keeps subcomponents. NESTED = component anatomy only; PAGE = also search the Figma page
matchstring[]YesTemplate patterns using {C} (component name) and {S} (subcomponent name) placeholders
excludestring[]NoTemplate patterns to exclude from matches. Same {C}/{S} syntax

An asset must match at least one match pattern to be considered a subcomponent. If it also matches an exclude pattern, the exclusion wins regardless of discovery source.

Path

figma.subcomponents in config/conventions.yaml

See Also