Using Swiper in React in 2024 #7354
saltnpixels
started this conversation in
Ideas
Replies: 1 comment
-
Nice job! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I had to implement a carousel in our project and I did some research and chose Swiper. However, I see it says the react version might be deprecated so I looked to the Web Component version.
I did not like how I did not have full control over some parts or it seemed like extra effort. I could not figure out how to swap- the arrow icons for my own. I tried to use the React version and found it was the same. Not enough ability to modify the basic html structure or requires way too much effort. We wanted the arrows changed to our icons. We wanted the arrows on the outside of the carousel at times. We wanted so many things.
So I went to core. And that's where things got extremely easy. By controlling the barebones we could do anything and it takes minutes to put this together. I recommend not using swiper web components or react. Just build your own react component using core. Waaaaaaay easier. Here is what I did:
We used Chakra so Box could be div and the css props can be swapped for style prop.
This makes a simple carousel that works. Has all the major things most people want. Nagivation, pagination with a simple boolean. You can also set to "outside" to put those items outside the carousel. We used our own Chevron icons from our own library.
Hope this helps someone.
Beta Was this translation helpful? Give feedback.
All reactions