3.2.2 • Published 9 months ago

@288-toolkit/slideshow v3.2.2

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

Slideshow

A slideshow component.

Slideshow.svelte

The Slideshow component provides all of the logic to create your own slideshow. Simply put, it's a controllable interval with next and previous functions to switch slides.

Note that this component renders no markup.

Props

items

The items to loop over in the slideshow.

export let items: Array<T>;

slideDuration

The duration of each individual slide, in milliseconds.

export let slideDuration = 3500;

autoplay

Whether the slideshow should run on its own. If this is set to false, only clicking on a SlideshowButton will allow moving from slide to slide.

export let autoplay = true;

loop

Whether the slideshow should go back to the first slide when doing next from the last slide; and, conversely, whether the slideshow should go to the last slide when doing previous from the first slide.

export let loop = true;

startDelay

The delay in milliseconds before the slideshow starts.

export let startDelay = 0;

Slot props

  • readonly item (T): The item currently shown by the slideshow
  • readonly index (number): The index of the item currently shown by the slideshow

Example

<Slideshow items={[1, 2, 3, 4]} let:item let:index>
	{#key item}
		<div class="bg-[red]" transition:fade>Slide {item} {index}</div>
	{/key}
</Slideshow>

SlideshowButton.svelte

The SlideshowButton component must be a child of Slideshow. It renders a button that will either move the slideshow to the previous or the next slide.

Usually, this button will be used twice: once for previous, and once more for next.

Props

direction

direction

The direction of the button.

export let direction: 'previous' | 'next';

class

Classes to apply to the button.

Example

<SlideshowButton direction="next">Next</SlideshowButton>
3.2.2

9 months ago

3.2.1

9 months ago

3.1.2

9 months ago

3.2.0

9 months ago

3.1.1

9 months ago

3.1.0

9 months ago

3.0.9

10 months ago

3.0.8

10 months ago

3.0.4

10 months ago

3.0.3

10 months ago

3.0.7

10 months ago

3.0.6

10 months ago

3.0.5

10 months ago

3.0.2

10 months ago

3.0.1

10 months ago

3.0.0

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago