React Spring Carousel

Swipe

By default, the useTransitionCarousel allows you to swipe to trigger the carousel navigation.


  import { useSpringCarousel } from 'react-spring-carousel'

  export function Component() {
    const { 
      carouselFragment, 
    } = useTransitionCarousel({
      items: (
        <CarouselItem color={i.color}>
          {i.title}
        </CarouselItem>
      ),
    });

    return (
      <div>
        {carouselFragment}
      </div>
    );
  }

You can, eventually, disable it by passing disableGestures: true

1
2  import { useSpringCarousel } from 'react-spring-carousel'
3
4  export function Component() {
5    const { carouselFragment } = useTransitionCarousel({
6      disableGestures: true,
7    });
8
9    // render stuff...
10  }
11