Need private packages and team management tools?Check out npm Teams »


1.0.2 • Public • Published

Coffeekraken s-swiper-component

Webcomponent wrapper around the freaking cool [Swiper]( library

View demo

Table of content

  1. Demo
  2. Install
  3. Get Started
  4. Javascript API
  6. Sugar Web Components Documentation
  7. Browsers support
  8. Code linting
  9. Contribute
  10. Who are Coffeekraken?
  11. Licence


npm install coffeekraken-s-swiper-component --save

Get Started

First, import the component into your javascript file like so:

import SSwiperComponent from "coffeekraken-s-swiper-component"

Then simply use it inside your html like so:

  <div s-swiper-swiper>
    <div s-swiper-slide>
      <img src="" />
    <div s-swiper-slide>
      <img src="" />
    <div s-swiper-slide>
      <img src="" />
    <div s-swiper-slide>
      <img src="" />
  <ul s-swiper-pagination>
    <!-- filled by swiper -->
  <div s-swiper-next></div>
  <!-- skin this as you want... -->
  <div s-swiper-previous></div>
  <!-- skin this as you want... -->

Generate the styles for the pagination if wanted like so:

@import "node_modules/coffeekraken-s-swiper-component/index";
@include s-swiper-classes($colors: default primary secondary);

This will gives you access to classes:

  • s-swiper: default color
  • s-swiper[color="primary"]: primary color
  • s-swiper[color="secondary"]: secondary color

This use the sugar colors system

Properties (options)

This webcomponent support every options that Swiper has to offer. You can set them using the html attributes or by using the setDefaultProps like so:

Using attributes

<s-swiper autoplay="{delay:4000}" speed="500" space-between="50">
  <!-- your swiper here... -->

Using setDefaultProps

import SWebComponent from "coffeekraken-sugar/js/core/SWebComponent"
    autoplay: {
      delay: 4000
    speed: 500,
    spaceBetween: 50

Supported modules

To keep the package size as small as possible, the webcomponent does not load all the Swiper modules. Here's the ones that are loaded and we think this is more than enough:

  • Swiper
  • Navigation
  • Pagination
  • Keyboard
  • Mousewheel
  • A11y
  • Autoplay
  • History
  • HashNavigation

Browsers support

IE / Edge
IE / Edge
IE11+ last 2 versions last 2 versions last 2 versions

As browsers are automatically updated, we will keep as reference the last two versions of each but this component can work on older ones as well.

The webcomponent API (custom elements, shadowDOM, etc...) is not supported in some older browsers like IE10, etc... In order to make them work, you will need to integrate the corresponding polyfill.

Code linting

This package uses some code linting rules. Here's the list:

  1. ESLint with airbnb and prettier rules for javascript files
  2. Stylelint with stylelint-config-standard for scss files

Your commits will not been accepted if the code style is not respected!


This is an open source project and will ever be! You are more that welcomed to contribute to his development and make it more awesome every day. To do so, you have several possibilities:

  1. Share the love ❤️
  2. Declare issues
  3. Fix issues
  4. Add features
  5. Build web component

Who are Coffeekraken

We try to be some cool guys that build some cool tools to make our (and yours hopefully) every day life better.

More on who we are


The code is available under the MIT license. This mean that you can use, modify, or do whatever you want with it. This mean also that it is shipped to you for free, so don't be a hater and if you find some issues, etc... feel free to contribute instead of sharing your frustrations on social networks like an asshole...


npm i coffeekraken-s-swiper-component

DownloadsWeekly Downloads






Unpacked Size

1.39 MB

Total Files


Last publish


  • avatar