SharePoint Framework Slide Swiper

Modern Swiper functionality as addition to every SharePoint intranet web part


More and more organizations demand for responsive mobile friendly intranets. With the help of SharePoint modern pages, SharePoint Framework we can build nice swipe, touch based webparts and improve the user experience when a site is used from tablet or smart phone.


React Slide Swiper sample is an example of touch friendly responsive web part


I recently submitted that sample to the SharePoint Patterns and Practices Github repo. The SPFx web part sample can be summarized in one image bellow, but there are more features implemented and can be controlled from the properties of the web part.


Here is a short video tutorial how the SPFx web part can be used and shot walk-through the code

React Slide Swiper with built-in properties so the slider can be configured


The sample comes with SPFx properties for controlling the slides on the page, autoplay, paging, navigation, different cursor or replay of the slides if all are displayed. More features can be added to the SPFx property pane since the Swiper has even more configuration options.


SharePoint responsive carousel web part


The SPFx client side solution can easily be extended with more carousel like features because it is based on a popular feature rich JavaScript library called Swiper. Due to the nature of the Swiper javascript library, we can turn the SPFx we part into a carousel displaying news or pictures. I highly recommend going on the Swiper demo page and see all the available slide, carousel examples.


Solution packaging and bundle optimization considerations


This sample uses the Swiper JavaScript library thought the npm packages, but just for the purpose of the sample so it can quickly be run without additional setup. It is highly recommended to add the Swiper library as SPFx solution external reference to resize the solution bundle size and improve Site Page load times.

For event further optimization, a custom Swiper build can be created to keep the javascript file to minimum size. Documentation on how to do it can be found on the official Swiper API reference.

Another advantage is that the Swiper library does not have dependencies on other heavy libraries like JQuery.


Conclusion


Using the SharePoint Framework allow us to use modern open source libraries like Swiper and quickly build solution for our customer without the need to reinvent the wheel. Take advantage of that now :)