Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lernen Navigation and Pagination | Configuring and Customizing SwiperJS
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Interactive React Sliders with Swiper.js

bookNavigation and Pagination

To make your SwiperJS slider more interactive and user-friendly in React, you can add navigation arrows and pagination bullets. These features help users move between slides easily and see their current position within the slider. SwiperJS provides built-in modules for both navigation and pagination, which you can enable and customize through the slider's props.

To enable navigation arrows, you use the navigation prop. This adds next and previous arrow buttons to your slider. For pagination bullets, you use the pagination prop. This displays clickable dots at the bottom of the slider, each representing a slide. You can also customize how these controls look and behave by passing options to these props.

For example, you can make pagination bullets clickable by setting clickable: true, or you can change their appearance with custom CSS. Similarly, navigation arrows can be styled or placed outside the slider if you want more control over their layout.

Here is a simple example of a SwiperJS slider in React with both navigation arrows and pagination bullets enabled and customized:

import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination } from 'swiper/modules';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';

export default function MySlider() {
  return (
    <Swiper
      modules={[Navigation, Pagination]}
      navigation
      pagination={{ clickable: true }}
      spaceBetween={30}
      slidesPerView={1}
    >
      <SwiperSlide>Slide 1</SwiperSlide>
      <SwiperSlide>Slide 2</SwiperSlide>
      <SwiperSlide>Slide 3</SwiperSlide>
    </Swiper>
  );
}

In this example, the modules prop includes both Navigation and Pagination. The navigation prop enables the arrow buttons, and the pagination prop enables clickable bullets. You can further customize these controls by passing additional options or by overriding their styles in your CSS.

question mark

Which statement is correct about enabling navigation and pagination in a SwiperJS slider in React?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2

Fragen Sie AI

expand

Fragen Sie AI

ChatGPT

Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen

Suggested prompts:

How can I further customize the appearance of the navigation arrows and pagination bullets?

Can I add more slides or change the content of each slide?

What other SwiperJS features can I use to enhance my slider?

bookNavigation and Pagination

Swipe um das Menü anzuzeigen

To make your SwiperJS slider more interactive and user-friendly in React, you can add navigation arrows and pagination bullets. These features help users move between slides easily and see their current position within the slider. SwiperJS provides built-in modules for both navigation and pagination, which you can enable and customize through the slider's props.

To enable navigation arrows, you use the navigation prop. This adds next and previous arrow buttons to your slider. For pagination bullets, you use the pagination prop. This displays clickable dots at the bottom of the slider, each representing a slide. You can also customize how these controls look and behave by passing options to these props.

For example, you can make pagination bullets clickable by setting clickable: true, or you can change their appearance with custom CSS. Similarly, navigation arrows can be styled or placed outside the slider if you want more control over their layout.

Here is a simple example of a SwiperJS slider in React with both navigation arrows and pagination bullets enabled and customized:

import { Swiper, SwiperSlide } from 'swiper/react';
import { Navigation, Pagination } from 'swiper/modules';
import 'swiper/css';
import 'swiper/css/navigation';
import 'swiper/css/pagination';

export default function MySlider() {
  return (
    <Swiper
      modules={[Navigation, Pagination]}
      navigation
      pagination={{ clickable: true }}
      spaceBetween={30}
      slidesPerView={1}
    >
      <SwiperSlide>Slide 1</SwiperSlide>
      <SwiperSlide>Slide 2</SwiperSlide>
      <SwiperSlide>Slide 3</SwiperSlide>
    </Swiper>
  );
}

In this example, the modules prop includes both Navigation and Pagination. The navigation prop enables the arrow buttons, and the pagination prop enables clickable bullets. You can further customize these controls by passing additional options or by overriding their styles in your CSS.

question mark

Which statement is correct about enabling navigation and pagination in a SwiperJS slider in React?

Select the correct answer

War alles klar?

Wie können wir es verbessern?

Danke für Ihr Feedback!

Abschnitt 2. Kapitel 2
some-alt