SharePoint Framework Slide Swiper


This SPFx React web part sample demonstrates mobile touch slide swiper. By default the web part is responsive, has cross device and browser touch support and uses paging, but additional features like navigation, auto play, loop of the slides and more can be enabled from the web part properties panel. The react slide swiper web part can be used as carousel as well. The slides or cards template can easily be customized.

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. Modern SharePoint carousel 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 :)

SharePoint Framework React Slide Swiper web part
Posted on

Tags: SharePoint Framework web part, SPFX, React SharePoint web part, PnP web part

Comments
Marc Wenning | 12 Mar 2018

How easy would this slider be to get the data from a sharepoint list instead of the sample data? I am new to the SP framework, but this is great just need it to pull from a list.


Velin Georgiev | 13 Mar 2018

You should be able to easly implement a new ListService from the IListService that pulls data from SharePoint list. You can use the the PnP JS Core (https://github.com/pnp/pnp or https://github.com/SharePoint/pnp) to retrieve the data. More on work with lists here https://github.com/SharePoint/PnP-JS-Core/wiki/Working-With:-Items