SwipiDocumentation

Guides

Responsive

Changing the number of visible slides per breakpoint, in Tailwind and in plain CSS, and the one change the observer cannot see.

Breakpoints are CSS

There is no breakpoints option, because there is nothing for it to do. The number of visible slides is a flex-basis, so a media query changes it, and a ResizeObserver notices the new measurement and recalculates the snap positions without a render. That is true in every framework — the CSS below is the whole mechanism.

Media queries
.carousel__slide {
  box-sizing: border-box;
  flex: 0 0 calc(100% / 3);
  min-width: 0;
  padding-left: 24px;
}

@media (max-width: 800px) {
  .carousel__slide {
    flex-basis: calc(100% / 2);
  }
}

@media (max-width: 580px) {
  .carousel__slide {
    flex-basis: 100%;
  }
}

Container queries

Nothing here is tied to the viewport width. If the carousel lives in a sidebar that changes width on its own, a container query is the more honest breakpoint — and it is measured the same way.

Container query
.carousel {
  container-type: inline-size;
}

@container (max-width: 640px) {
  .carousel__slide {
    flex-basis: 100%;
  }
}

The one change that goes unnoticed

Change it through spaceBetween instead, reading --swipi-slide-gap in your CSS as described in Spacing & sizing. A breakpoint that changes the gap and the number of visible slides is fine either way — the width changes with it.

React
const [carouselRef] = useSwipiCarousel({
  spaceBetween: isMobile ? 12 : 24
})

@ Copyright 2026 Midstem. All rights reserved.

DocsMidstemGitHubLinkedin