Blossom Carousel Logo
Migration Guides

Swiper

Migrate from Swiper to Blossom Carousel by replacing Swiper modules, wrappers, and configuration with native scrolling and CSS.

Swiper provides a large carousel system with framework components, modules, configuration options, lifecycle events, and built-in effects.

Blossom keeps the carousel as a native scroll container. Layout, snapping, spacing, breakpoints, and many effects move back into CSS, while Blossom adds dragging and small convenience methods.

Migration mindset

When moving from Swiper to Blossom, migrate the carousel in three steps:

  1. Replace <Swiper> and <SwiperSlide> with a single <BlossomCarousel> root and direct children.
  2. Move Swiper options such as slidesPerView, spaceBetween, direction, and breakpoints into CSS.
  3. Replace Swiper modules and events with Blossom methods, native scroll APIs, and browser observers.
Most Swiper migrations become smaller when you start with the markup and CSS first, then add back only the behavior the product still needs.

Installation

Remove Swiper and install the matching Blossom package for your framework.

npm uninstall swiper
npm install @blossom-carousel/vue

Import Blossom's core stylesheet once in your app.

import "@blossom-carousel/core/style.css";

Component structure

Swiper wraps slides in framework-specific components. Blossom uses the carousel root as the scroll container and treats direct children as slides.

<script setup lang="ts">
import { Swiper, SwiperSlide } from "swiper/vue";import "swiper/css";import { BlossomCarousel } from "@blossom-carousel/vue";import "@blossom-carousel/core/style.css";</script>

<template>
  <Swiper :slides-per-view="4" :space-between="16">    <SwiperSlide>Slide 1</SwiperSlide>    <SwiperSlide>Slide 2</SwiperSlide>    <SwiperSlide>Slide 3</SwiperSlide>  </Swiper>  <BlossomCarousel class="carousel grid! grid-auto-cols grid-cols-[25%] gap-4">    <div class="slide snap-center">Slide 1</div>    <div class="slide snap-center">Slide 2</div>    <div class="slide snap-center">Slide 3</div>  </BlossomCarousel></template>

Options

Swiper options describe how its engine should size slides, attach modules, and calculate movement. In Blossom, most of those choices become CSS or small browser APIs.

Swiper conceptBlossom approach
slidesPerViewUse CSS grid-auto-columns to define the relative width of slides.
spaceBetweenUse CSS gap in a grid or flex layout.
direction: "horizontal"Automatically handled by Blossom based on native overscroll.
centeredSlidesUse CSS scroll-snap-align: center on slides.
breakpointsUse CSS media queries and container queries.
loopPrefer bounded native scrolling, or use the experimental repeat pattern when an infinite effect is required. See Repeat example.
freeModeOmit scroll-snap-align or use scroll-snap-type: proximity.
allowTouchMoveUse CSS overflow: hidden on the carousel to disable dragging and scrolling.
effect modulesUse CSS transforms, scroll-driven animations, or intersection state.

For example, this Swiper setup:

Swiper
const swiperOptions = {
  slidesPerView: 1,
  spaceBetween: 16,
  centeredSlides: false,
  breakpoints: {
    768: { slidesPerView: 3, centeredSlides: true },
  },
};

becomes CSS:

Blossom
.carousel {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  gap: 1rem;
  scroll-snap-type: inline mandatory;
}

.slide {
  scroll-snap-align: start;
}

@media (min-width: 768px) {
  .carousel {
    grid-auto-columns: calc((100% - 2rem) / 3);
  }

  .slide {
    scroll-snap-align: center;
  }
}

Controls

Swiper controls call methods on a Swiper instance. Blossom exposes prev() and next() on the carousel element or component ref.

swiper.slidePrev();swiper.slideNext();blossom.value.prev();blossom.value.next();

For direct slide navigation, use native scrolling on the target slide.

slides[index].scrollIntoView({
  behavior: "smooth",
  inline: "center",
  block: "nearest",
});

API

Swiper commonly uses events such as slideChange and properties such as activeIndex.

With Blossom, the carousel is a real scroll container, so use browser APIs such as IntersectionObserver, scrollsnapchange, or scroll events depending on the browser support you need.

swiper.on("slideChange", () => {  setSelectedIndex(swiper.activeIndex);});
carousel.addEventListener("scrollsnapchange", (event) => {  setSelectedIndex(event.detail.index);});
Or use IntersectionObserver for wider browser support

const slides = Array.from(carousel.children);const observer = new IntersectionObserver(   (entries) => {    const activeEntry = entries.find((entry) => entry.isIntersecting);    if (activeEntry) {      setSelectedIndex(slides.indexOf(activeEntry.target));    }  },  { root: carousel, threshold: 0.5 },);slides.forEach((slide) => observer.observe(slide));

Modules

Swiper modules usually become either native browser features or small code that calls Blossom methods.

Swiper module patternBlossom replacement
NavigationButtons that call prev() and next().
PaginationDots backed by IntersectionObserver or scrollsnapchange.
AutoplayA timer that calls next() or scrolls the next slide into view.
KeyboardKeyboard handlers that call prev() and next().
MousewheelNative scrolling where possible.
GridCSS grid.
Effect Fade / Cards / CoverflowCSS scroll-driven animations or intersection state.

Start with a working native-scroll carousel before rebuilding effects. Many Swiper effects are visual polish, not required carousel mechanics.

Lifecycle

Swipers's and Blossom's lifecycle methods are similar.

Blossom initializes automatically when using framework components.
swiper.update();swiper.destroy();blossom.init();blossom.destroy();

Migration checklist

  • Remove Swiper packages and install the matching Blossom package.
  • Import @blossom-carousel/core/style.css once.
  • Replace <Swiper> and <SwiperSlide> with <BlossomCarousel> and direct slide children.
  • Move slide sizing, gaps, snapping, direction, and breakpoints into CSS.
  • Replace slidePrev() and slideNext() with prev() and next().
  • Replace slideTo() with scrollIntoView() or native scrollTo().
  • Replace Swiper events with browser observers or scroll snap events.
  • Rebuild only the Swiper modules your carousel still needs.

Next steps

  • Installation - Pick the package for your framework.
  • Snapping - Configure scroll snap behavior with CSS.
  • Buttons - Add previous and next controls.
  • Dots - Track the active slide with browser APIs.
  • Repeat - Explore an experimental repeating carousel pattern.