Skip to content

devzom/astro-swiper

 
 

Repository files navigation

Astro Swiper

Astro Swiper - native component for Swiper. Use for slides, carousel, photo swiper.

Installation

npm install astro-swiper
pnpm add astro-swiper
bun install astro-swiper

Usage

Carousel with loop, 3 pictures, 1 second interval:

---
import { Swiper, SwiperWrapper, SwiperSlide } from "astro-swiper";
---

<Swiper
// check options at https://swiperjs.com/swiper-api
  options={{
    loop: true,
    autoplay: {
      delay: 700,
      disableOnInteraction: false,
      waitForTransition: false
    }
  }}>
  <SwiperWrapper>
    <SwiperSlide>
      <img src="https://picsum.photos/455/256?nb=1" alt="" />
    </SwiperSlide>
    <SwiperSlide>
      <img src="https://picsum.photos/455/256?nb=2" alt="" />
    </SwiperSlide>
    <SwiperSlide>
      <img src="https://picsum.photos/455/256?nb=3" alt="" />
    </SwiperSlide>
  </SwiperWrapper>
</Swiper>

<style>
  .swiper {
    max-width: 455px;
    aspect-ratio: 16/9;
  }

  img {
    width: 100%;
  }
</style>

Examples

Check the online doc for a fullset of examples, including navigation and thumbnails. Full code is provided.

You can also look at how others are using astro-swiper in public github repo:

Help needed?

Do you need help to integrate astro-swiper in your astro template / component? I'll be happy to help!

  • mention me with @pascal-brand38 in an issue on your own github repo
  • or fill a GitHub issue in astro-swiper github

Support us

Let's star the project as you like it.

About

Astro component for swiper, dedicated to slider / carousel / photo swiper / slide. ⭐️ Star to support

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Astro 62.7%
  • TypeScript 35.4%
  • JavaScript 1.9%