Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
学ぶ SwiperJS Props and Options | Configuring and Customizing SwiperJS
Interactive React Sliders with Swiper.js

bookSwiperJS Props and Options

メニューを表示するにはスワイプしてください

When working with SwiperJS in React, you can control the slider's behavior and appearance using a set of essential props. The most important SwiperJS props to understand include:

  • spaceBetween: sets the amount of space, in pixels, between each slide;
  • slidesPerView: determines how many slides are visible in the viewport at once;
  • loop: enables continuous loop mode, allowing the slider to cycle from the last slide back to the first;
  • direction: controls the direction of the slider, which can be either "horizontal" (default) or "vertical".

Each of these props can significantly change how your slider looks and behaves. For example, adjusting spaceBetween can make slides appear more separated or tightly grouped, while increasing slidesPerView allows users to see more content at once. Enabling loop creates a seamless, infinite scrolling experience, and changing direction can be useful for vertical carousels or unique layouts.

import { Swiper, SwiperSlide } from 'swiper/react';

<Swiper
  spaceBetween={30}
  slidesPerView={3}
  loop={true}
  direction="horizontal"
>
  <SwiperSlide>Slide 1</SwiperSlide>
  <SwiperSlide>Slide 2</SwiperSlide>
  <SwiperSlide>Slide 3</SwiperSlide>
  <SwiperSlide>Slide 4</SwiperSlide>
</Swiper>

In this example, the slider will display three slides at a time, with 30 pixels of space between each slide, looping enabled, and a horizontal orientation. You can adjust these props to match your design and user experience needs. Passing these options as props is the standard way to customize SwiperJS in React.

question mark

Which SwiperJS prop would you adjust if you want to show more slides at the same time within the visible area of your slider?

正しい答えを選んでください

すべて明確でしたか?

どのように改善できますか?

フィードバックありがとうございます!

セクション 2.  1

AIに質問する

expand

AIに質問する

ChatGPT

何でも質問するか、提案された質問の1つを試してチャットを始めてください

セクション 2.  1
some-alt