An open API service indexing awesome lists of open source software.

https://github.com/yoonbuck/svelte-snappy-carousel

Page-snapping carousel for svelte
https://github.com/yoonbuck/svelte-snappy-carousel

Last synced: about 1 month ago
JSON representation

Page-snapping carousel for svelte

Awesome Lists containing this project

README

        

# svelte-snappy-carousel

Touch-friendly snappy horizontal carousel for svelte.

[Demo](https://svelte-snappy-carousel.dev.yoonbuck.com/)

## Usage

```svelte

import { Carousel, CarouselItem } from "svelte-snappy-carousel";



Pane 1


...




Pane 2


...




Pane 3


...


```

## Adding controls

Use `slot="inner-controls"` or `slot="outer-controls"` to add controls to the carousel.

`inner-controls` will be placed inside the carousel container; `outer-controls` will be after.

```svelte




{position + 1} / {count}

.controls {
/* e.g., position absolutely inside carousel container */
}

```

# Limitations

These are some
things to watch out for. Note that these limitations might change in the future.

- **No nested Carousels**

You can't place a `` inside another ``

- **No dynamic content**

You shouldn't add or remove ``s after the parent `` is mounted.

It's okay to use an `{#each}` block if you know the backing array won't change. The contents of the array can change, as long as the `(key)`s stay the same, and the array doesn't grow or shrink.

If you're loading content asynchronously, you should either wrap the entire `` in your `{#await}` block, or place `{#await}` blocks inside of individual `` components.