Overview

In this article we will understand the complete process of using PnP search webpart in SharePoint Modern Pages.

Introduction

In SharePoint, with the introduction of Modern Sites and Modern Pages, we aren't able to change templates in Modern Pages, so if we want to use a customized search in SharePoint Modern sites it would be best to use some existing webparts. To that end, PnP has released Modern Search webparts which will be very helpful and easy to configure. So let's start configuring it.
Step 1
Download the latest release of PnP Search webpart using the below link to download the webpart:
Link : https://github.com/microsoft-search/pnp-modern-search/releases
Step 2
Upload the .sppkg file in the App Catalog. We can use any of the app catalog site collections or tenant level app catalogs.
In the popup click on deploy to deploy the solution
Step 3
Add the app in the site collection using "+ New" button present in the home page.
Select PnP Modern Search - Search Web parts
Step 4 - Create a Modern page & set up the required search webpart
  1. Add Search box webpart – This will be used as search text box where we can add a search term for the search results
  2. Add Search results webpart – This will be used for displaying the search results associated with search box.
Configuration for Search box
Below are all the configurations that can help you setup the PnP Search box
How To Use And Configure PnP Search WebPart

Configuration for Search results

The configuration for search results is divided into three section or pages
Section 1(connection to Search Text box)
How To Use And Configure PnP Search WebPartHow To Use And Configure PnP Search WebPart
Section 2 (search, pagination setting)
Search Setting,
Pagination Setting
How To Use And Configure PnP Search WebPart
Section 3 (style, template setting)
Style Setting
Template Setting
How To Use And Configure PnP Search WebPart
Outcome
How To Use And Configure PnP Search WebPart

Summary

We checked how easy it is to configure and use PnP Modern Search Webparts. We can even use other webparts which are available as a part of the package like Search Filters and Search Navigation.