Skip to content

Props

Props define the configurable inputs of a component. Each prop has a type, a default value, and optional extensions.

type Props = Record<string, AnyProp>;
type AnyProp = BooleanProp | StringProp | EnumProp | NumberProp | SlotProp | ImageProp;

Prop Kinds

BooleanProp

PropertyTypeRequiredDescription
type'boolean'Yes
defaultbooleanYesDefault value
$extensionsPropExtensionsNoVendor extensions

EnumProp

PropertyTypeRequiredDescription
type'string'Yes
defaultstringYesDefault value (must be in enum)
enumstring[]YesAllowed values
nullablebooleanNoWhether null is a valid value — absent means false
$extensionsPropExtensionsNoVendor extensions

StringProp

PropertyTypeRequiredDescription
type'string'Yes
defaultstring | nullNoDeprecated — use examples
nullablebooleanNoWhether null is a valid value — absent means true
examplesstring[]NoExample values
$extensionsPropExtensionsNoVendor extensions

A StringProp is distinguished from an EnumProp by the absence of enum.

NumberProp

PropertyTypeRequiredDescription
type'number'Yes
defaultnumberNoDefault value
nullablebooleanNoWhether null is a valid value — absent means true (since 0.29.0)
examplesnumber[]NoExample values

Inferred from Figma variant values when inferNumberProps is enabled.

SlotProp

PropertyTypeRequiredDescription
type'slot'Yes
defaultstring | nullNoDefault slot content
nullablebooleanNoWhether null is a valid value — absent means true
minChildrennumberNoMinimum number of children the slot accepts (since 0.25.0)
maxChildrennumberNoMaximum number of children the slot accepts (since 0.25.0)
anyOfstring[]NoPermitted component type names (since 0.14.0)
$extensionsPropExtensionsNoVendor extensions

Slot constraint properties (minChildren, maxChildren, anyOf) are emitted when slotConstraints is enabled in config.

ImageProp

PropertyTypeRequiredDescription
type'image'Yes
defaultstring | nullNoDefault image — an images registry reference, or null
nullablebooleanNoWhether null is a valid value — absent means true
$extensionsPropExtensionsNoVendor extensions

An image-valued property (e.g. a dsImage source prop). The authoring-default image rides on the ImageBinding at the binding site, not on the prop. Emitted for code-only props named in processing.images.sourceProps (since 0.28.0).

Nullability

nullable is optional on every prop kind that carries it. Its absence is meaningful, and what it means depends on whether the prop’s value set is open or closed:

Prop kindAbsent nullable meansWhy
StringProptrueOpen value set — nothing enumerates it
NumberProptrueOpen value set
SlotProptrueOpen content set; a slot may be empty
ImageProptrueOpen value set
EnumPropfalseenum lists every accepted value, and null is not one of them
BooleanProp(no field)Booleans are never nullable

An explicit nullable: false on an open-valued prop asserts that a value always exists — useful when a code-only prop was authored with a non-empty default:

props:
# No nullable key — accepts null
label:
type: string
# Explicitly asserts a value is always present
headingLevel:
type: number
default: 2
nullable: false

Extensions

The $extensions object holds vendor-specific metadata. Currently only the com.figma extension is defined.

FigmaPropExtension

PropertyTypeDescription
typestringFigma property type (e.g. BOOLEAN, TEXT, INSTANCE_SWAP, VARIANT)
sourceFigmaCodeOnlySourcePresent when the prop originates from a code-only prop layer

FigmaCodeOnlySource

PropertyTypeDescription
kind'codeOnlyProp'Always 'codeOnlyProp'
layerstringSub-layer name in the code-only container
instanceOfstringComponent name, for enum code-only props

Further Reading