react-id-swiper
A library to use Swiper as a ReactJs component (Providing lightweight version of Swiper which reduces ~40kb of minified size)
What is Swiper?
Swiper - is the free and most modern mobile touch slider with hardware accelerated transitions and amazing native behavior. It is intended to be used in mobile websites, mobile web apps, and mobile native/hybrid apps. Designed mostly for iOS, but also works great on latest Android, Windows Phone 8 and modern Desktop browsers
Swiper is not compatible with all platforms, it is a modern touch slider which is focused only on modern apps/platforms to bring the best experience and simplicity.
React-id-swiper's original props
Name | Type | Default value | Description |
---|---|---|---|
ContainerEl | String | 'div' | Element type for container |
containerClass | String | swiper-container | Swiper container class name |
WrapperEl | String | 'div' | Element type for wrapper |
wrapperClass | String | swiper-wrapper | Swiper wrapper class name |
slideClass | String | swiper-slide | Swiper slide class name |
shouldSwiperUpdate | Boolean | false | Update swiper when component is updated |
rebuildOnUpdate | Boolean | false | Rebuild swiper when component is updated |
noSwiping | Boolean | false | Disable swiping by condition |
activeSlideKey | String | null | Initial slide index |
renderPrevButton | function | Render props function for prev button | |
renderNextButton | function | Render props function for next button | |
renderScrollbar | function | Render props function for scrollbar | |
renderPagination | function | Render props function for pagination | |
renderParallax | function | Render props function for parallax |
React-id-swiper's deprecated props (from v1.6.3)
- renderCustomPrevButton
- renderCustomNextButton
- renderCustomScrollbar
- renderCustomPagination
- renderCustomParallax
- prevButtonCustomizedClass,
- nextButtonCustomizedClass,
- paginationCustomizedClass,
- scrollbarCustomizedClass
NOTE: You can also use Swiper's original params too.Swiper API documentation HERE
Installation
By npm
By Yarn
You can also use the standalone UMD build
Recommendation
Swiper stylesheet file is required
Use Swiper stylesheet file from CDN
OR
Use stylesheet file from src/styles/ folder (supporting css, scss)
Usage
Example with default
Example with default params
Example with params
Example with navigation buttons
Example with manipulating swiper from outside swiper component
Example with navigation button
How to add customized class for swiper?
Example with navigation button
How to add customized components?
Example with customized navigation button
For customized rendering to work, you have to use same classname with params el.
React-Id-Swiper also provides lightweight version for Swiper (reduce ~40kb of minified size)
Those features below are not included in lightweight version
- Virtual
- Keyboard
- Mouse wheel
- Zoom
- Lazy load image
- A11y
- Parallax
- History
- Hash-navigation
- Effect-cube
- Effect-flip
- Effect-coverflow
Instead of
Use
Build demo in local
First, clone this repo to your local
Install node packages
or
Run webpack server
Run tests