|
| 1 | +# Carousel Component |
| 2 | + |
| 3 | +The Carousel component is the main container that manages slides, navigation, and overall carousel functionality. |
| 4 | + |
| 5 | +## Basic Usage |
| 6 | + |
| 7 | +```vue |
| 8 | +<template> |
| 9 | + <Carousel> |
| 10 | + <Slide v-for="slide in 10" :key="slide"> |
| 11 | + <div class="carousel__item">{{ slide }}</div> |
| 12 | + </Slide> |
| 13 | + |
| 14 | + <template #addons> |
| 15 | + <Navigation /> |
| 16 | + <Pagination /> |
| 17 | + </template> |
| 18 | + </Carousel> |
| 19 | +</template> |
| 20 | +``` |
| 21 | + |
| 22 | +## Slots |
| 23 | + |
| 24 | +### Default/Slides Slot |
| 25 | + |
| 26 | +Used to render the carousel items. You can use either the default slot or wrap elements in the `slides` slot. |
| 27 | + |
| 28 | +```vue |
| 29 | +<template> |
| 30 | + <Carousel> |
| 31 | + <template #slides> |
| 32 | + <Slide v-for="slide in 10" :key="slide"> |
| 33 | + ... |
| 34 | + </Slide> |
| 35 | + </template> |
| 36 | + </Carousel> |
| 37 | +</template> |
| 38 | +``` |
| 39 | + |
| 40 | +### Addons Slot |
| 41 | + |
| 42 | +Used to add display carousel addon components such as Navigation and Pagination. |
| 43 | + |
| 44 | +```vue |
| 45 | +<template> |
| 46 | + <Carousel> |
| 47 | + ... |
| 48 | + <template #addons> |
| 49 | + <Navigation /> |
| 50 | + <Pagination /> |
| 51 | + </template> |
| 52 | + </Carousel> |
| 53 | +</template> |
| 54 | +``` |
| 55 | + |
| 56 | +## Slot Props |
| 57 | + |
| 58 | +The following props are passed to slots and can be used within them: |
| 59 | + |
| 60 | +| Name | Type | Description | |
| 61 | +| -------------- | ------- | ------------------------------------------- | |
| 62 | +| `config` | Object | Configuration object with carousel settings. | |
| 63 | +| `currentSlide` | Number | Index number of the current slide. | |
| 64 | +| `maxSlide` | Number | The maximum slide index. | |
| 65 | +| `middleSlide` | Number | The middle slide index. | |
| 66 | +| `minSlide` | Number | The minimum slide index. | |
| 67 | +| `slideSize` | Number | The width/height of a single slide element. | |
| 68 | +| `slidesCount` | Number | The count of all slides. | |
| 69 | + |
| 70 | +## Styling |
| 71 | + |
| 72 | +The Carousel component provides several CSS classes that you can use for styling: |
| 73 | + |
| 74 | +| CSS Class | Description | |
| 75 | +| -------------------- | --------------------------------- | |
| 76 | +| `.carousel` | Main carousel container | |
| 77 | +| `.carousel__viewport`| Carousel viewport/wrapper element | |
| 78 | +| `.carousel__track` | Container for slides | |
| 79 | + |
| 80 | +For more information about configuration options, see the [Configuration documentation](/config). |
0 commit comments