Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

sp webpart base.iwebpartpropertymetadata.dynamicpropertytype

John Nguyen edited this page Apr 22, 2021 · 2 revisions

Home > @microsoft/sp-webpart-base > IWebPartPropertyMetadata > dynamicPropertyType

IWebPartPropertyMetadata.dynamicPropertyType property

If specified, indicates that the property is a dynamic property and the type of the dynamic property.

Signature:

dynamicPropertyType?: 'boolean' | 'number' | 'string' | 'array' | 'object';

Remarks

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.

Clone this wiki locally