Create multiple props (Beta)
Create multiple props (Beta)
component.createProps(options)
Creates multiple props on a component in a single transaction.
This is the bulk counterpart to component.createProp(), accepting an array of prop definitions and returning an array of created props in the same order.
The operation is all-or-nothing: if any prop in the array fails validation, no props are created.
Name conflict auto-increment applies across the entire batch and against props that already exist on the component.
For example, if two items in the array both specify name: 'Heading' in the same group, the second becomes 'Heading 2'.
Beta
These methods are in public beta and may change with future releases.
Syntax
The CreatePropOptions type and Prop response type are identical to those used by component.createProp().
Parameters
options: CreatePropOptions[] — An array of prop definitions. Each item uses the same shape as theoptionsparameter ofcomponent.createProp(). The array must contain at least one item.
Returns
Promise<Prop[]>
A Promise that resolves to an array of Prop objects in the same order as the input array.
Each Prop object has the same shape as the return value of component.createProp().
Examples
Create multiple props at once:
Name conflicts auto-increment within the batch: