Splide
Splide builds a carousel from a root element, track, list, slide elements, options, extensions, and a JavaScript instance.
Blossom keeps the carousel as a native scroll container. Layout, slide sizing, gaps, snapping, and responsive behavior belong in CSS, while Blossom adds dragging and small convenience methods.
Migration mindset
When moving from Splide to Blossom, migrate the carousel in three steps:
- Replace the Splide root, track, and list structure with a single
<BlossomCarousel>root. - Move Splide options such as
perPage,gap,focus,direction, andbreakpointsinto CSS. - Replace Splide instance calls and events with Blossom methods, native scroll APIs, and browser observers.
Installation
Remove Splide and install the matching Blossom package for your framework.
npm uninstall @splidejs/vue-splide @splidejs/splide
npm install @blossom-carousel/vue
npm uninstall @splidejs/react-splide @splidejs/splide
npm install @blossom-carousel/react
npm uninstall @splidejs/svelte-splide @splidejs/splide
npm install @blossom-carousel/svelte
npm uninstall @splidejs/splide
npm install @blossom-carousel/core
Import the stylesheet from your framework package once in your app.
import "@blossom-carousel/vue/style.css";
import "@blossom-carousel/react/style.css";
import "@blossom-carousel/svelte/style.css";
import "@blossom-carousel/core/style.css";
import "@blossom-carousel/web/style.css";
Component structure
Splide usually needs a root, track, list, and slide elements. Blossom uses one scroll container with direct slide children.
<script setup lang="ts">
import { Splide, SplideSlide } from "@splidejs/vue-splide";import "@splidejs/vue-splide/css";import { BlossomCarousel } from "@blossom-carousel/vue";import "@blossom-carousel/vue/style.css";</script>
<template>
<Splide :options="{ perPage: 4, gap: '1rem' }"> <SplideSlide>Slide 1</SplideSlide> <SplideSlide>Slide 2</SplideSlide> <SplideSlide>Slide 3</SplideSlide> </Splide> <BlossomCarousel class="carousel grid! grid-auto-cols grid-cols-[calc((100% - 3rem) / 4)] gap-4"> <div class="slide snap-start">Slide 1</div> <div class="slide snap-start">Slide 2</div> <div class="slide snap-start">Slide 3</div> </BlossomCarousel></template>
import { Splide, SplideSlide } from "@splidejs/react-splide";import "@splidejs/react-splide/css";import { BlossomCarousel } from "@blossom-carousel/react";import "@blossom-carousel/react/style.css";
export function Carousel() {
return (
<Splide options={{ perPage: 4, gap: "1rem" }}> <SplideSlide>Slide 1</SplideSlide> <SplideSlide>Slide 2</SplideSlide> <SplideSlide>Slide 3</SplideSlide> </Splide> <BlossomCarousel className="carousel grid! grid-auto-cols grid-cols-[calc((100% - 3rem) / 4)] gap-4"> <div className="slide snap-start">Slide 1</div> <div className="slide snap-start">Slide 2</div> <div className="slide snap-start">Slide 3</div> </BlossomCarousel> );
}
<script>
import { Splide, SplideSlide } from "@splidejs/svelte-splide"; import "@splidejs/svelte-splide/css"; import { BlossomCarousel } from "@blossom-carousel/svelte"; import "@blossom-carousel/svelte/style.css";
const options = { perPage: 4, gap: "1rem" };</script>
<Splide {options}> <SplideSlide>Slide 1</SplideSlide> <SplideSlide>Slide 2</SplideSlide> <SplideSlide>Slide 3</SplideSlide></Splide><BlossomCarousel class="carousel grid! grid-auto-cols grid-cols-[calc((100% - 3rem) / 4)] gap-4"> <div class="slide snap-start">Slide 1</div> <div class="slide snap-start">Slide 2</div> <div class="slide snap-start">Slide 3</div></BlossomCarousel><div class="splide"> <div class="splide__track"> <ul class="splide__list"> <li class="splide__slide">Slide 1</li> <li class="splide__slide">Slide 2</li> <li class="splide__slide">Slide 3</li> </ul> </div></div><blossom-carousel class="carousel grid! grid-auto-cols grid-cols-[calc((100% - 3rem) / 4)] gap-4"> <div class="slide snap-start">Slide 1</div> <div class="slide snap-start">Slide 2</div> <div class="slide snap-start">Slide 3</div></blossom-carousel>Options
Splide options describe slide movement, sizing, and generated controls. In Blossom, those choices usually become CSS and small browser APIs.
| Splide concept | Blossom approach |
|---|---|
perPage | Use CSS grid-auto-columns to define the relative width of slides. |
perMove | Use CSS scroll-snap-align within :nth-child(xn) or nest slides in groups. |
gap | Use CSS gap in a grid or flex layout. |
focus: "center" | Use scroll-snap-align: center. |
direction | Use dir="rtl" or CSS direction: rtl. |
breakpoints | Use CSS media queries and container queries. |
type: "loop" | Prefer bounded native scrolling, or use the experimental repeat pattern when an infinite effect is required. See Repeat example. |
drag: "free" | Omit scroll-snap-align or use scroll-snap-type: proximity. |
arrows | Use <BlossomPrev> and <BlossomNext>. See Buttons example. |
pagination | Use <BlossomDots for="my-carousel"> and mark slides with data-blossom-slide. See Dots example. |
For example, this Splide setup:
new Splide(".splide", {
perPage: 1,
gap: "1rem",
focus: "center",
breakpoints: {
768: { perPage: 3 },
},
}).mount();
becomes CSS:
.carousel {
display: grid;
grid-auto-flow: column;
grid-auto-columns: 100%;
gap: 1rem;
scroll-snap-type: inline mandatory;
}
.slide {
scroll-snap-align: center;
}
@media (min-width: 768px) {
.carousel {
grid-auto-columns: calc((100% - 2rem) / 3);
}
}
Controls
Splide controls call methods on the Splide instance. Blossom provides <BlossomPrev>, <BlossomNext>, and <BlossomDots> components that link to the carousel through matching id and for props.
splide.go("<");splide.go(">");<BlossomCarousel id="gallery" class="carousel">
<div data-blossom-slide class="slide">Slide 1</div>
...
</BlossomCarousel>
<div class="controls">
<BlossomPrev for="gallery" />
<BlossomNext for="gallery" />
</div>
<BlossomDots for="gallery" />
For direct slide navigation, call goTo(index) on the carousel. It scrolls to the slide at that zero-based index, counting slides marked with data-blossom-slide. Reach the carousel through a template ref in Vue, a ref in React, bind:this in Svelte, or the <blossom-carousel> element itself.
carousel.goTo(index);
carousel.goTo(index, { behavior: "instant" });
API
Splide commonly uses moved or active events to track the current slide.
With Blossom, read the active slide from useBlossomNavigation in Vue, React, and Svelte. Pass the carousel id; it returns activeIndex, count, canPrev, and canNext, and updates during drag and free scrolling too.
splide.on("moved", (newIndex) => { setSelectedIndex(newIndex);});
const nav = useBlossomNavigation("gallery");In React and Svelte, read nav.activeIndex. In Vue, nav is a ref, so read nav.value.activeIndex in script or nav.activeIndex in the template. Don't destructure the result in Svelte; that loses reactivity.
With Web Components, listen for the native scrollsnapchange event where it's supported:
const slides = Array.from(carousel.querySelectorAll("[data-blossom-slide]"));
carousel.addEventListener("scrollsnapchange", (event) => {
setSelectedIndex(slides.indexOf(event.snapTargetInline));
});
Extensions
Splide extensions and built-in UI usually become small Blossom wrappers or native platform features.
| Splide pattern | Blossom replacement |
|---|---|
| Arrows | <BlossomPrev> and <BlossomNext> components. |
| Pagination | <BlossomDots> with data-blossom-slide on slides. |
| Autoplay | A manual timer that scrolls the next slide into view. |
| Auto width | Let slide content size itself with CSS. |
| Auto height | Let content define height, or update layout with ResizeObserver. |
| Grid / rows | CSS grid. |
| Lazy load | Native loading="lazy" and content-visibility: auto. |
Keep extension migrations small. Start from a working Blossom carousel, then add behavior only if the product still needs it.
Lifecycle
Splide's and Blossom's lifecycle methods are similar.
splide.refresh();splide.destroy();blossom.init();blossom.destroy();Migration checklist
- Remove Splide packages and install the matching Blossom package.
- Import the stylesheet from your framework package once (for example
@blossom-carousel/vue/style.css). - Replace Splide root, track, list, and slide wrappers with
<BlossomCarousel>and direct slide children. - Move slide sizing, gaps, snapping, direction, focus, and breakpoints into CSS.
- Replace
go("<")andgo(">")with<BlossomPrev>and<BlossomNext>. - Replace
go(index)withgoTo(index)on the carousel. - Replace Splide events with
useBlossomNavigation(orscrollsnapchangefor Web Components). - Rebuild only the Splide extensions 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 - Add dot markers with
<BlossomDots>. - Repeat - Explore an experimental repeating carousel pattern.