This is an easy one, but I keep Googling it.

When you create an SPFx web part, the default Property Pane automatically submits changes to the web part. There is no “Apply” button.

Property Pane without Apply
Default property pane — no Apply button
But sometimes you don’t want changes to the property pane fields to automatically apply.

All you have to do is to add this method in your web part class (just before

getPropertyPaneConfiguration is where I like to place it):
protected get disableReactivePropertyChanges(): boolean {
        return true;
}

When you refresh the web part, your property pane will sport a fancy Apply button!

 

PropertyPaneWithApply.png
Property pane with an Apply button

Property changes in the property pane will only get applied when users hit Apply.

 

That’s it!

Author

Microsoft MVP and PnP Team Member. Independent consultant. Certified SCRUM Master. SharePoint, Office 365 and Dynamics 365 are his favourite toys.

How can I help?

This site uses Akismet to reduce spam. Learn how your comment data is processed.