-
Notifications
You must be signed in to change notification settings - Fork 6
sp webpart base.iwebpartpropertymetadata.dynamicpropertytype
Home > @microsoft/sp-webpart-base > IWebPartPropertyMetadata > dynamicPropertyType
If specified, indicates that the property is a dynamic property and the type of the dynamic property.
Signature:
dynamicPropertyType?: 'boolean' | 'number' | 'string' | 'array' | 'object';
If a web part has properties that are dynamically configurable, then use this flag to declare the property as a dynamic property by specifying its type. When a property specifies its dynamic property type, then the framework ensures that its value can be accessed using 'tryGetValue' anytime in the life cycle of the web part. If a property is marked as DynamicProperty in the IWebPartProperties interface, but does not appear in the IWebPartPropertiesMetadata with a dynamicPropertyType, then the web part developer will need to manually create the DynamicProperty themselves and assign it to the property.
A web part can configure a default value for the property by specifying it in the properties section of the web part's manifest. This value will be used when a dynamic property is constructed for the property.
Note: Web parts should be able to type cast the resultant value from the tryGetValue
to suit their needs.