figma_create_component_set
Creates a Figma component set with variants in one call, either by generating variants from a base component and property axes or by combining existing components.
Instructions
Create a component set with variants in one call — replaces hand-written figma.combineAsVariants scripts.
Two modes:
Generate from a base component: pass baseComponentId + properties (variant axes). The base is cloned for every combination of the axes ({ State: ['default','hover','disabled'], Size: ['sm','lg'] } → 6 variants), each named 'Prop=Value' comma-joined (e.g. 'State=hover, Size=sm'), then combined into a set. The base component itself becomes the FIRST variant (same node ID), so existing instances of the base survive as instances of that variant.
Combine existing components: pass componentIds, optionally with variantProperties (aligned 1:1) to rename each component to Prop=Value form before combining.
Figma derives the variant property definitions from the names; they live on the SET (componentPropertyDefinitions), not on individual variants. The result includes each variant's key — instantiate with a VARIANT's key/nodeId via figma_instantiate_component, not the set's key.
Set autoArrange:true to lay the new set out as a labeled grid inside a white container (same layout as figma_arrange_component_set). Requires Desktop Bridge plugin.
SIZE GUIDANCE: hard cap 100 variants. The timeout auto-scales with variant count (~1.2s/variant, 30s floor / 2min cap), but above ~40 variants the single-pass clone+combine gets slow and heavy base components may still push the limit — prefer splitting large matrices into multiple sets (e.g. one set per Size).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | No | Name for the component set (e.g., 'Button'). Defaults to Figma's derived name. | |
| parentId | No | Node ID of the container (frame/section) to create the set in. Defaults to the current page. | |
| position | No | Position of the set within its parent. | |
| properties | No | Variant property axes — required with baseComponentId. Example: { State: ['default','hover','disabled'], Size: ['sm','lg'] } creates 6 variants. Max 100 combinations. Names and values must not contain '=' or ','. | |
| autoArrange | No | If true, arrange the new set in a labeled grid (columns = last property, rows = other properties) inside a white container — same in-place layout as figma_arrange_component_set. | |
| componentIds | No | Node IDs of existing COMPONENT nodes to combine as variants. Mutually exclusive with baseComponentId. Components already inside a component set are rejected. | |
| arrangeOptions | No | Grid layout options, used when autoArrange is true. | |
| baseComponentId | No | Node ID of an existing COMPONENT to use as the base. Cloned per property combination; becomes the set's first variant (keeps its node ID, so placed instances survive). Mutually exclusive with componentIds. | |
| variantProperties | No | Only with componentIds: one property map per component, aligned by index — e.g. [{ State: 'default' }, { State: 'hover' }]. Each component is renamed to 'Prop=Value, ...' before combining. Without this, existing names are kept (names lacking '=' become 'Property 1=<name>'). |