SharePoint Framework (SPFx) Extensions extend the SharePoint user experience by customizing predefined placeholders in the SharePoint site. As of today, we can extend the top and bottom placeholders to customize the header and footer section. React components help to develop functionality independently by maintaining separation of concerns. These React components can be used as part of application customizer.
Solution Name: Hit Enter to have a default name (spfx-react-applicationcustomizer in this case) or type in any other name for your solution.
Selected choice: Hit enter
Target for component: Here, we can select the target environment where we are planning to deploy the client web part i.e. SharePoint Online or SharePoint OnPremise (SharePoint 2016 onwards).
Selected choice: SharePoint Online only (latest)
Place of files: We may choose to use the same folder or create a subfolder for our solution.
Selected choice: Use the current folder.
Deployment option: Selecting Y will allow the app to deployed instantly to all sites and will be accessible everywhere.
Selected choice: Y
Permissions to access web APIs: Choose if the components in the solution require permissions to access web APIs that are unique and not shared with other components in the tenant.
Selected choice: N (solution contains unique permissions)
Type of client-side component to create: We can choose to create client-side webpart or an extension.
Selected choice: Extension
Type of client-side extension to create: We can choose to create Application customizer, Field customizer, or ListView Command Set.
Selected choice: Application Customizer
Application customizer name: Hit Enter to select the default name or type in any other name.
Selected choice: ReactHeaderFooter
Application customizer description: Hit Enter to select the default description or type in any other value.
Selected choice: Adds custom header and footer to a SharePoint site
Yeoman generator will perform scaffolding process to generate the solution. The scaffolding process will take a significant amount of time.
Once the scaffolding process is completed, lock down the version of project dependencies by running below command.
In the command prompt type the below command to open the solution in code editor of your choice.
To use Office 365 UI Fabric controls, type below command. We will explicitly install the 5.x version of the Office UI Fabric to our solution.
One thing to note here is that during the solution creation, Yeoman generator did not ask us for the choice of language to use.
Implement Application Customizer
Open ReactHeaderFooterApplicationCustomizer.ts under “\src\extensions\ reactHeaderFooter \” folder. To get access to placeholders on the page, use below imports.
Implement the OnDispose method.
Add a new file to solution – ReactFooter.tsx.