|
9 | 9 | | `breakpoints` | `object` | null | Responsive breakpoint configurations. Each breakpoint can override any carousel prop. |
|
10 | 10 | | `clamp` | `boolean` | false | If true will clamp itemsToShow to the number of available slides |
|
11 | 11 | | `dir` | 'ltr', 'rtl', 'ttb', 'btt' | 'ltr' | Carousel sliding direction. Supports horizontal (ltr/rtl) and vertical (ttb/btt) orientations. |
|
12 |
| -| `dragThreshold` | `number` | 0.3 | Define a threshold for the drag distance required to trigger a slide transition. | |
13 | 12 | | `enabled` | `boolean` | true | Controls whether the carousel is interactive. When false, all interactions are disabled. |
|
14 | 13 | | `gap` | `number` | 0 | Space (in pixels) between carousel slides. |
|
15 | 14 | | `height` | `number` \| `string` | 'auto' | Sets the carousel track height. Required for vertical orientation. |
|
|
18 | 17 | | `itemsToScroll` | `number` | 1 | Number of slides to move when navigating. Useful for creating slide groups. |
|
19 | 18 | | `itemsToShow` | `number` \| 'auto' | 1 | Number of slides visible simultaneously. Use 'auto' for variable width slides. |
|
20 | 19 | | `modelValue` | `number` | 0 | Controls the active slide index. Can be used with v-model for two-way binding. |
|
21 |
| -| `mouseDrag` | `boolean` | true | Enables/disables mouse drag navigation. | |
| 20 | +| `mouseDrag` | `boolean` \| `DragConfig` | true | Enables/disables mouse drag navigation. See [Drag Options](#drag-options) for configuration details. | |
| 21 | +| `mouseWheel` | `boolean` \| `WheelConfig` | false | Enables/disables mouse wheel scrolling for carousel navigation. See [Wheel Options](#wheel-options) for configuration details. | |
22 | 22 | | `pauseAutoplayOnHover` | `boolean` | false | When true, autoplay pauses while the mouse cursor is over the carousel. |
|
23 | 23 | | `preventExcessiveDragging` | `boolean` | false | Limits dragging behavior at carousel boundaries for better UX. <Badge text="0.13.0" /> |
|
24 | 24 | | `slideEffect` | 'slide', 'fade' | 'slide' | Determines the transition effect between slides. |
|
25 | 25 | | `snapAlign` | 'start', 'end', 'center-odd', 'center-even' | 'center' | Determines how slides are aligned within the viewport. |
|
26 |
| -| `touchDrag` | `boolean` | true | Enables/disables touch navigation on touch-enabled devices. | |
| 26 | +| `touchDrag` | `boolean` \| `DragConfig` | true | Enables/disables touch navigation on touch-enabled devices. See [Drag Options](#drag-options) for configuration details. | |
27 | 27 | | `transition` | `number` | 300 | Duration of the slide transition animation in milliseconds. |
|
28 | 28 | | `wrapAround` | `boolean` | false | When true, creates an infinite loop effect by connecting the last slide to the first. |
|
29 | 29 |
|
|
33 | 33 |
|
34 | 34 | > **Drag Prevention**: The `preventExcessiveDragging` option is automatically disabled when `wrapAround` is enabled, as boundary restrictions aren't needed in infinite loop mode.
|
35 | 35 |
|
| 36 | +## Drag Options |
| 37 | + |
| 38 | +Both `mouseDrag` and `touchDrag` properties accept either a boolean value or a `DragConfig` object with the following properties: |
| 39 | + |
| 40 | +| Property | Type | Default | Description | |
| 41 | +|-------------|----------|---------|--------------------------------------------------------------------------------------------| |
| 42 | +| `threshold` | `number` | 0.3 | Controls the drag distance required to trigger a slide transition, as a fraction of slide width. Higher values require more dragging to trigger a slide change. | |
| 43 | + |
| 44 | +### Example |
| 45 | + |
| 46 | +```vue |
| 47 | +<template> |
| 48 | + <Carousel |
| 49 | + :mouseDrag="{ threshold: 0.5 }" |
| 50 | + :touchDrag="{ threshold: 0.7 }" |
| 51 | + > |
| 52 | + <!-- Slides --> |
| 53 | + </Carousel> |
| 54 | +</template> |
| 55 | +``` |
| 56 | + |
| 57 | +## Wheel Options |
| 58 | + |
| 59 | +The `mouseWheel` property accepts either a boolean value or a `WheelConfig` object with the following properties: |
| 60 | + |
| 61 | +| Property | Type | Default | Description | |
| 62 | +|---------------|----------|---------|--------------------------------------------------------------------------------------------| |
| 63 | +| `threshold` | `number` | 10 | Controls the wheel movement threshold required to trigger a slide transition. Higher values require more scrolling to trigger a slide change. | |
| 64 | + |
| 65 | + |
| 66 | +### Example |
| 67 | + |
| 68 | +```vue |
| 69 | +<template> |
| 70 | + <Carousel |
| 71 | + :mouseWheel="{ threshold: 20 }" |
| 72 | + > |
| 73 | + <!-- Slides --> |
| 74 | + </Carousel> |
| 75 | +</template> |
| 76 | +``` |
| 77 | + |
| 78 | +## I18n |
| 79 | + |
| 80 | +Available keys: |
| 81 | + |
| 82 | +| Key | Defaults | Description | |
| 83 | +| --------------------- | -------------------------------------- | -------------------------------------------------------------------------- | |
| 84 | +| `ariaGallery` | "Gallery" | Used as the aria-label for the main carousel element, indicating purpose. | |
| 85 | +| `ariaNavigateToSlide` | "Navigate to slide {slideNumber}" | Sets title and aria-label for pagination buttons to select a slide. | |
| 86 | +| `ariaNextSlide` | "Navigate to next slide" | Sets title and aria-label for the "Next" navigation button. | |
| 87 | +| `ariaPreviousSlide` | "Navigate to previous slide" | Sets title and aria-label for the "Previous" navigation button. | |
| 88 | +| `iconArrowDown` | "Arrow pointing downwards" | Sets title and aria-label for the downward-pointing arrow SVG icon. | |
| 89 | +| `iconArrowLeft` | "Arrow pointing to the left" | Sets title and aria-label for the left-pointing arrow SVG icon. | |
| 90 | +| `iconArrowRight` | "Arrow pointing to the right" | Sets title and aria-label for the right-pointing arrow SVG icon. | |
| 91 | +| `iconArrowUp` | "Arrow pointing upwards" | Sets title and aria-label for the upward-pointing arrow SVG icon. | |
| 92 | +| `itemXofY` | "Item {currentSlide} of {slidesCount}" | Provides screen readers with the current slide's position in the sequence. | |
| 93 | + |
36 | 94 | ## Slots
|
37 | 95 |
|
38 | 96 | ### Slides/Default
|
@@ -119,3 +177,16 @@ Available keys:
|
119 | 177 | | `iconArrowRight` | "Arrow pointing to the right" | Sets title and aria-label for the right-pointing arrow SVG icon. |
|
120 | 178 | | `iconArrowUp` | "Arrow pointing upwards" | Sets title and aria-label for the upward-pointing arrow SVG icon. |
|
121 | 179 | | `itemXofY` | "Item {currentSlide} of {slidesCount}" | Provides screen readers with the current slide's position in the sequence. |
|
| 180 | + |
| 181 | +### Example |
| 182 | + |
| 183 | +```vue |
| 184 | +<template> |
| 185 | + <Carousel |
| 186 | + :mouseDrag="{ threshold: 0.5 }" |
| 187 | + :touchDrag="{ threshold: 0.7 }" |
| 188 | + > |
| 189 | + <!-- Slides --> |
| 190 | + </Carousel> |
| 191 | +</template> |
| 192 | +``` |
0 commit comments