
Security News
Feross on the 10 Minutes or Less Podcast: Nobody Reads the Code
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.
solid-slider-old
Advanced tools
A carousel/slider implementation in TypeScript for SolidJS. It's built on Keen-Slider 6, an open-source library agnostic touch slider with native touch/swipe behavior and great performance. It comes with no dependencies, TypeScript support, multitouch support and is compatible with all common browsers.
This package providers both primitive & directive as well as components. You may use either according to your preference. Note that for better SSR support, the component is recommended over the directive.
npm install solid-slider --save
yarn add solid-slider ## or in yarn
Import either the directive or component as you'd like:
import "solid-slider/slider.css";
import { Slider, createSlider } from "solid-slider";
You can find a functional demo of the slider with most features implemented here: https://codesandbox.io/s/solid-slider-j0x2g
Plugins may be added directly via the createSlider primitive. You may add a Keen-Slider plugin directly or built-in plugins shipped with this package. Currently an autoplay plugin is available that will assist with autoplaying actions in the slider. Simply add the plugins after the options parameter. Please feel free to post requests for additional plugins or submit PRs if you decide to improve the base functionality. Some ideas for additional plugins include:
Details on applying plugins are available for each use below.
The following is an example of how to use the component.
const MyComponent = () => {
return (
<Slider options={{ loop: true }}>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</Slider>
);
};
You may also use the next and previous button. Note that you must wrap your Slider with SliderProvider.
const MyComponent = () => {
return (
<SliderProvider>
<Slider options={{ loop: true }}>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</Slider>
<SliderButton prev>Previous</SliderButton>
<SliderButton next>Next</SliderButton>
<SliderProvider>
);
};
You may include the autoplay plugin by providing it as a prop:
import createSlider from "solid-slider";
import autoplay from "solid-slider/plugins/autoplay";
const MyComponent = () => {
return (
<Slider options={{ loop: true }} plugins={[autoplay(1500, {})]}>
<div class="slide1">1</div>
<div class="slide2">2</div>
<div class="slide3">3</div>
<div class="slide4">4</div>
<div class="slide5">5</div>
<div class="slide6">6</div>
</Slider>
);
};
The following is an example of how to create and then bind options using a directive.
const MyComponent = () => {
const options = { duration: 1000 };
const [slider, { current, next, prev, moveTo }] = createSlider(options);
return (
<div use:slider>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</div>
);
};
or without a directive:
const MyComponent = () => {
let ref: HTMLElement;
const options = { duration: 1000 };
const [slider, { current, next, prev, moveTo }] = createSlider(options);
onMount(() => {
slider(ref);
});
return (
<div ref={ref}>
<div>Slide 1</div>
<div>Slide 2</div>
<div>Slide 3</div>
</div>
);
};
The autoplay function extends the slider with pausable playing. You can even supply a signal to control toggling autoplay. Click here for a demo of autoplay.
import createSlider from "solid-slider";
import autoplay from "solid-slider/plugins/autoplay";
const [pause, togglePause] = createSignal(false);
const [slider] = createSlider(
{ loop: true },
autoplay(2000, {
pause,
pauseOnDrag: true,
})
);
Solid Slider is meant to be a lightweight and compact wrapper of Keen-Slider. It exposes helpers to make working with the slider convenient. Note that the when the slider mounts it assumes all children in the el are slides. You can override this functionality by passing in a "selector" value to target the specific slides you'd like to include.
Thie library exports it's own CSS which is the basic Keen-Slider implementation for convenience. If you supply options as an accessor function, the slider will reactively update the configuration so that you don't have to destroy and recreate the slider. As of Keen-Slider 6 plugins are now fully supported. You may supply them as a param in createSlider. Note that plugins are not reactively updated and must be supplied on creation.
You can set options to the slider via parameters. Note that there are other hooks available as well. Only a subset of useful methods are exposed via the primitive although you can access the slider instance as well from the exports to use the methods directly.
FAQs
A slider utility for SolidJS.
We found that solid-slider-old demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.