All Projects → beyonk-adventures → Svelte Carousel

beyonk-adventures / Svelte Carousel

Licence: mit
A super lightweight, super simple Carousel for Svelte 3

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Svelte Carousel

Simple Slider
🎠 The 1kb JavaScript Carousel
Stars: ✭ 583 (+304.86%)
Mutual labels:  slider, carousel, slide
Hooper
🎠 A customizable accessible carousel slider optimized for Vue
Stars: ✭ 561 (+289.58%)
Mutual labels:  slider, carousel, slide
React Siema
ReactSiema Demo
Stars: ✭ 90 (-37.5%)
Mutual labels:  slider, carousel, slide
React Whirligig
A react carousel/slider like component for sequentially displaying slides or sets of slides
Stars: ✭ 20 (-86.11%)
Mutual labels:  slider, carousel, slide
React Native Carousel View
react-native carousel, support in both Android and iOS
Stars: ✭ 70 (-51.39%)
Mutual labels:  slider, carousel
React Slidy
🍃 React Slidy - Minimalistic and smooth touch slider and carousel component for React
Stars: ✭ 69 (-52.08%)
Mutual labels:  slider, slide
React Responsive Carousel
React.js Responsive Carousel (with Swipe)
Stars: ✭ 1,962 (+1262.5%)
Mutual labels:  slider, carousel
Vue Slide Bar
🎢 A Simple Vue Slider Bar Component.
Stars: ✭ 129 (-10.42%)
Mutual labels:  slider, slide
Tiny Swiper
Ingenious JavaScript Carousel powered by wonderful plugins. Lightweight yet extensible. Import plugins as needed, No more, no less.
Stars: ✭ 1,061 (+636.81%)
Mutual labels:  slider, carousel
Svelte Social Auth
Social Auth for Svelte v3
Stars: ✭ 86 (-40.28%)
Mutual labels:  svelte, vanilla-js
Vue Swipe Mobile
😃 A siwpe (touch slider) component for Vue2
Stars: ✭ 97 (-32.64%)
Mutual labels:  slider, slide
React Carousel
Lightweight carousel component for react
Stars: ✭ 56 (-61.11%)
Mutual labels:  slider, carousel
React Soft Slider
Simple, fast and impartial slider
Stars: ✭ 54 (-62.5%)
Mutual labels:  slider, carousel
Vue Agile
🎠 A carousel component for Vue.js
Stars: ✭ 1,167 (+710.42%)
Mutual labels:  carousel, slide
Jcslider
🏂 A responsive slider jQuery plugin with CSS animations
Stars: ✭ 52 (-63.89%)
Mutual labels:  slider, slide
Ngx Carousel
An amazing responsive carousel for angular 2+ . It have multiple options to control the carousel and also it is very simple to getstarted. Go and try this angular 2+ carousel. Getstarted available in readme file
Stars: ✭ 121 (-15.97%)
Mutual labels:  slider, carousel
React Spring Slider
A slider component for react
Stars: ✭ 118 (-18.06%)
Mutual labels:  slider, carousel
Xam.plugin.simpleappintro
Just a nice and simple AppIntro for your Xamarin Forms project
Stars: ✭ 139 (-3.47%)
Mutual labels:  slider, carousel
Nanocal
Airbnb range picker rip-off
Stars: ✭ 132 (-8.33%)
Mutual labels:  svelte, vanilla-js
Slendr
A responsive & lightweight (2KB gzipped) slider for modern browsers. [UNMAINTAINED]
Stars: ✭ 39 (-72.92%)
Mutual labels:  slider, slide

Beyonk

Svelte Carousel

js-standard-style CircleCI svelte-v2 svelte-v3

Svelte Carousel / Slider

This is a ground-up rewrite of the original Svelte Carousel/Slider using Svelte v3, and Siema, the goal being a fully working carousel with a tiny size.

Usage

This library is pure javascript, so can be used with any framework you like.

Demo

The simplest possible demo

npm install
npm run dev # http://localhost:12001

To use within a Svelte application:

npm i -D @beyonk/svelte-carousel

Usage

<Carousel>
  <div class="slide-content">Slide 1</div>
  <div class="slide-content">Slide 2</div>
  <div class="slide-content">Slide 3</div>
  <div class="slide-content">Slide 4</div>
</Carousel>

<script>
	import Carousel from '@beyonk/svelte-carousel'
	import { ChevronLeftIcon, ChevronRightIcon } from 'svelte-feather-icons'
</script>

Options

Controls

You can set the controls to be anything you like, though the default height and width are set to 40px. Just use the slots available to insert your own content.

npm i -D svelte-feather-icons
<Carousel>
  <span class="control" slot="left-control">
    <ChevronLeftIcon />
  </span>
  <div class="slide-content">Slide 1</div>
  ...
  <div class="slide-content">Slide n</div>
  <span class="control" slot="right-control">
    <ChevronRightIcon />
  </span>
</Carousel>

<script>
	import Carousel from './Carousel.svelte'
	import { ChevronLeftIcon, ChevronRightIcon } from 'svelte-feather-icons'
</script>

If you need to override height and width, you can use CSS:

	.control :global(svg) {
		width: 100%;
		height: 100%;
		color: #fff;
		border: 2px solid #fff;
		border-radius: 32px;
	}

Attributes

You can pass the following attributes:

Attribute Type Default Value Description
loop boolean true At the end of the carousel, loop through to the first slide again, seamlessly
perPage integer 3 Number of slides on a single page. Note that this needs to be greater than or equal to the number of slides in your carousel
autoplay integer 0 Auto-change slide at an interval (in milliseconds). 0 means don't autoplay.
duration number 200 Slide transition duration in milliseconds.
easing string 'ease-out' It is like a CSS transition-timing-function — describes acceleration curve.
startIndex number 0 Index (zero-based) of the starting slide.
draggable boolean true Use dragging and touch swiping.
multipleDrag boolean true Allow dragging to move multiple slides.
dots boolean true Toggles visibility of slider dots.
controls boolean true Toggles visibility of slider controls. dots.
threshold number 20 Touch and mouse dragging threshold (in px).
rtl boolean false Enables layout for languages written from right to left (like Hebrew or Arabic).

perPage can also be set to a responsive object, to change the number of slides based on screen width:

<Carousel perPage={{ 800: 3, 500: 2 }}>
// will show 1 slide below 500px width, 2 at 500, 3 at 800.

Events

The Carousel components emits the following events:

Name Data Description
change { currentSlide, slideCount } currentSlide: The current slide index. Can be a positive or negative integer. slideCount: The number of slides.

Actions

You can call left, right, go(slideNumber), pause and resume functions on the slider. For example, for pausing the autoslide while the mouse is hover the carousel

<Carousel bind:this={carousel} on:mouseenter={enter} on:mouseleave={leave}>
<div class="slide-content">Slide 1</div>
...
<div class="slide-content">Slide n</div>
</Carousel>

<script>
import Carousel from './Carousel.svelte'
let carousel;

function enter() {
  carousel.pause();
}

function leave() {
  carousel.resume();
}
</script>
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].