Question

I am planning to develop a SPFx WebPart for SharePoint online search, this should be exactly the way we used to customize the display template in SharePoint On-Premise search, could someone please give me some references or examples to start with. Thank you!!!

Was it helpful?

Solution

As mentioned in the comment, you can use the SharePoint Modern Search web part. You can download the package from this url: https://github.com/microsoft-search/pnp-modern-search/releases

Once you deploy the solution, it will provide you with few web parts (6 of them), for example, you can add the Refiners web part and it will provide you with a dropdown list for all the managed properties available for you to filter (you'll need to have the managed properties ready to be used):

enter image description here

You can connect it to the search results web part that comes with the solution using a web part property as well:

enter image description here

On the search results web part, you can filter it the way you want. You can also choose one of the predefined templates available based on the result type you're getting:

enter image description here

or you can edit the HTML that's generated through the way you want by having a custom template:

enter image description here

Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange
scroll top