@rozie-ui/embla-vue
| Install | |
|---|---|
npm install @rozie-ui/embla-vue |
|
| Latest Version: | 0.1.9 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 24, 2026 |
| Links: | GitHub · npm |
@rozie-ui/embla-vue
Idiomatic vue Carousel — a cross-framework carousel compiled from one Rozie source wrapping Embla Carousel (v8). The current snap is two-way bound via selectedIndex; slides come as a slides config array or as default-slot DOM. This package is generated; do not edit src/ by hand.
Declarative-mode slides must carry
class="rozie-embla__slide". The component pins Embla'sslidesoption to that exact selector, so unclassed default-slot children are not measured as slides.
Install
npm i @rozie-ui/embla-vue
Peer dependencies: the embla-carousel (^8.6) + embla-carousel-autoplay (^8.6) engine packages + vue. Install them alongside this package.
No engine CSS to import — the carousel skeleton styles (overflow: hidden viewport, flex container, slide sizing) ship scoped inside the component.
Usage
<script setup lang="ts">
import { ref } from 'vue';
import Carousel from '@rozie-ui/embla-vue';
const index = ref(0);
</script>
<template>
<Carousel
:slides="['A', 'B', 'C']"
v-model:selectedIndex="index"
:loop="true"
@select="(i) => console.log('snap', i)"
/>
</template>
Props
| Name | Type | Default | Two-way (model) | Required |
|---|---|---|---|---|
slides |
Array |
[] |
||
loop |
Boolean |
false |
||
align |
String |
"center" |
||
axis |
String |
"x" |
||
slidesToScroll |
Number |
1 |
||
dragFree |
Boolean |
false |
||
draggable |
Boolean |
true |
||
containScroll |
String |
"trimSnaps" |
||
startIndex |
Number |
0 |
||
skipSnaps |
Boolean |
false |
||
duration |
Number |
25 |
||
direction |
String |
"ltr" |
||
autoplay |
Boolean |
false |
||
autoplayDelay |
Number |
4000 |
||
dots |
Boolean |
false |
||
arrows |
Boolean |
false |
||
thumbnails |
Boolean |
false |
||
plugins |
Array |
[] |
||
options |
Object |
{} |
||
selectedIndex |
Number |
0 |
✓ |
Events
| Event | Payload | Description |
|---|---|---|
select |
index: number | Fires on every snap change (drag, scroll, or programmatic). Distinct from the selectedIndex model prop — a model prop must not share a name with an emit. |
settle |
— | Fires when carousel motion stops (after a drag, scroll, or reInit settles). |
reInit |
— | Fires when the engine re-initialises (an option flip, a slide add/remove, or a manual reInitCarousel() call). The current snap is preserved across it. |
pointer-down |
— | Fires when a pointer drag begins on the viewport. |
Imperative handle
Beyond props, the component exposes imperative methods (declared once in the Rozie source via $expose). Grab a handle with the native ref mechanism and call them directly:
<script setup>
import { ref } from 'vue';
const carousel = ref(); // template ref
</script>
<template>
<Carousel ref="carousel" ... />
<button @click="carousel.scrollNext()">Next</button>
</template>
| Method | Description |
|---|---|
scrollNext |
Scroll to the next snap — scrollNext(jump?) (jump skips the transition). No-op before mount. |
scrollPrev |
Scroll to the previous snap — scrollPrev(jump?). No-op before mount. |
scrollToIndex |
Scroll to a specific snap index — scrollToIndex(index, jump?) (Embla scrollTo). Named to avoid the inherited DOM HTMLElement.scrollTo(x, y). No-op before mount. |
reInitCarousel |
Re-initialise the Embla engine (recompute snaps) — reInitCarousel(opts?). Pass raw EmblaOptionsType to override; omit to re-apply the current prop-derived options. (NOT reInit, which is the emitted event.) |
canScrollNext |
Return whether a next snap is reachable — canScrollNext(). False before mount. |
canScrollPrev |
Return whether a previous snap is reachable — canScrollPrev(). False before mount. |
getSelectedIndex |
Return the current scroll-snap index — getSelectedIndex() (Embla selectedScrollSnap()). 0 before mount. (NOT selectedIndex, which is the two-way model prop.) |
scrollSnapList |
Return the snap-point progress array — scrollSnapList() (numbers in [0, 1]). Empty before mount. |
scrollProgress |
Return the overall scroll progress in [0, 1] — scrollProgress() — to drive a custom progress bar / scrollbar thumb. 0 before mount. |
slidesInView |
Return the indices of slides currently in view — slidesInView() — for lazy-loading or highlighting in-view dots. Empty before mount. |
slidesNotInView |
Return the indices of slides currently out of view — slidesNotInView() — to unload heavy off-screen content. Empty before mount. |
previousScrollSnap |
Return the previously selected snap index — previousScrollSnap() — to compute transition direction. 0 before mount. |
getPlugins |
Return the live plugin API map — getPlugins() (e.g. getPlugins().autoplay?.play()/.stop()) for imperative autoplay pause/resume. (NOT plugins, which is a prop.) Null before mount. |
getInstance |
Return the underlying EmblaCarouselType instance for direct API access (the engine escape hatch). Null before mount. |
Slots
| Slot | Params |
|---|---|
| slide | slide, index |
| (default) | |
| thumb | slide, index |
Related Packages
Fast, Lightweight Vue Carousel With Touch, Mouse, Keyboard, Wheel & SSR support
Version History
| Version | Released | Vue | License |
|---|---|---|---|
| 0.1.9 | ^3.4 | MIT | |
| 0.1.8 | ^3.4 | MIT | |
| 0.1.7 | ^3.4 | MIT | |
| 0.1.6 | ^3.4 | MIT | |
| 0.1.5 | ^3.4 | MIT | |
| 0.1.4 | ^3.4 | MIT | |
| 0.1.3 | ^3.4 | MIT | |
| 0.1.2 | ^3.4 | MIT |