# solidjs-swiper

> A simple image swiper built in Solid-JS

Latest version **1.0.15** (published 2023-08-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install solidjs-swiper
pnpm add solidjs-swiper
yarn add solidjs-swiper
bun add solidjs-swiper
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.15 |
| Published | 2023-08-22 |
| First published | 2022-09-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 22.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Andrei Telteu |
| Maintainers | andreitelteu |
| Keywords | solidjs, swiper, swiperjs, astro |

## Links

- npm: https://www.npmjs.com/package/solidjs-swiper
- Repository: https://github.com/AndreiTelteu/solidjs-swiper
- Homepage: https://github.com/AndreiTelteu/solidjs-swiper#readme
- Issues: https://github.com/AndreiTelteu/solidjs-swiper/issues
- npm.io page: https://npm.io/package/solidjs-swiper

## Alternatives

- [adhdev](https://npm.io/package/adhdev.md) — 11.1K weekly downloads
- [react-slide-button](https://npm.io/package/react-slide-button.md) — 310 weekly downloads
- [better](https://npm.io/package/better.md) — 42 weekly downloads
- [react-native-swipe-image](https://npm.io/package/react-native-swipe-image.md) — 22 weekly downloads
- [nl.fokkezb.pulltorefresh](https://npm.io/package/nl.fokkezb.pulltorefresh.md) — 11 weekly downloads

## Recent versions

- 1.0.15 (latest) — 2023-08-22
- 1.0.14 — 2023-01-04
- 1.0.13 — 2023-01-04
- 1.0.12 — 2022-10-01
- 1.0.11 — 2022-09-24
- 1.0.10 — 2022-09-24
- 1.0.9 — 2022-09-23
- 1.0.8 — 2022-09-23
- 1.0.7 — 2022-09-23
- 1.0.6 — 2022-09-23
- 1.0.5 — 2022-09-23
- 1.0.4 — 2022-09-23
- 1.0.3 — 2022-09-23
- 1.0.2 — 2022-09-23
- 1.0.1 — 2022-09-23
- … 1 more at https://npm.io/package/solidjs-swiper/versions

## README

# solidjs-swiper

[![bundlejs](https://deno.bundlejs.com/badge?q=solidjs-swiper@1.0.15&treeshake=[{+Swiper+}])](https://bundlejs.com/?q=solidjs-swiper%401.0.15&treeshake=%5B%7B+Swiper+%7D%5D)

A simple image swiper built in Solid-JS. This is not Swiper.js ! it's a custom package inspired by swiper.js

Demo here: https://codesandbox.io/s/solidjs-swiper-demo-2r25of?file=/src/App.tsx

## Install

```bash
npm install solidjs-swiper
```

```bash
yarn add solidjs-swiper
```

## Usage example

```tsx
import { createSignal, Component } from 'solid-js';
import { OnReadyApi, Swiper } from 'solidjs-swiper';

const App: Component = () => {
  // You can specity the type of each item here. Optional. Works evem witout it.
  const demoImages = [
    { img: 'https://picsum.photos/id/10/400/200' },
    { img: 'https://picsum.photos/id/1/400/200' },
    { img: 'https://picsum.photos/id/100/400/200' },
    { img: 'https://picsum.photos/id/101/400/200' },
  ];

  const [pictures, setPictures] = createSignal(demoImages);
  const [index, setIndex] = createSignal(0);
  let swiperApi: OnReadyApi;
  setTimeout(() => swiperApi?.next(), 1600);
  setTimeout(() => swiperApi?.prev(), 2000);

  return (
    <div style="width: 400px">
      <Swiper
        items={pictures()}
        index={index()}
        onReady={(api) => {
          swiperApi = api;
        }}
        onChange={(i) => setIndex(i)}
      >
        {(item, index) => (
          <img
            src={item.img}
            style="width: 100%; height: 100%; object-fit: cover; display: block;"
            alt={'Item: ' + index()}
          />
        )}
      </Swiper>
      Active index: {index()}
    </div>
  );
};
export default App;
```

## Roadmap:

|          |                                                    |
| :------- | :------------------------------------------------- |
| ✅       | First version out 🎉🥳                             |
| ✅       | Export api with `prev` and `next` methods          |
| ✅       | Add `onChange` event                               |
| &#x2610; | Autoplay with delay config and stop on interaction |
| &#x2610; | Support for loop                                   |

## Changelog

### v1.0.15

- Migrated from rollup to [tsup-preset-solid](https://github.com/solidjs-community/tsup-preset-solid)

### v1.0.14

- Fixed onMouseLeave bug

### v1.0.13

- Type-safety for props and children item.
  Heavy inspiration from solid's [For component](https://github.com/solidjs/solid/blob/main/packages/solid/src/render/flow.ts#L29). Thank you solidjs !

---
_Source: https://npm.io/package/solidjs-swiper · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
