All Projects → farbenmeer → React Spring Slider

farbenmeer / React Spring Slider

Licence: mit
A slider component for react

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to React Spring Slider

React Siema
ReactSiema Demo
Stars: ✭ 90 (-23.73%)
Mutual labels:  component, slider, carousel
Vue Glide
A slider and carousel as vue component on top of the Glide.js
Stars: ✭ 225 (+90.68%)
Mutual labels:  component, slider, carousel
React Grid Carousel
React responsive carousel component w/ grid layout
Stars: ✭ 29 (-75.42%)
Mutual labels:  slider, carousel
React Splide
The Splide component for React.
Stars: ✭ 32 (-72.88%)
Mutual labels:  slider, carousel
Zoid
Cross domain components
Stars: ✭ 1,672 (+1316.95%)
Mutual labels:  hacktoberfest, component
Egjs Flicking
🎠 ♻️ Everyday 30 million people experience. It's reliable, flexible and extendable carousel.
Stars: ✭ 937 (+694.07%)
Mutual labels:  slider, carousel
React Whirligig
A react carousel/slider like component for sequentially displaying slides or sets of slides
Stars: ✭ 20 (-83.05%)
Mutual labels:  slider, carousel
Ngx Siema
Lightweight and simple carousel with no dependencies.
Stars: ✭ 46 (-61.02%)
Mutual labels:  component, carousel
Glide
A dependency-free JavaScript ES6 slider and carousel. It’s lightweight, flexible and fast. Designed to slide. No less, no more
Stars: ✭ 6,256 (+5201.69%)
Mutual labels:  slider, carousel
React Carousel
Lightweight carousel component for react
Stars: ✭ 56 (-52.54%)
Mutual labels:  slider, carousel
React Soft Slider
Simple, fast and impartial slider
Stars: ✭ 54 (-54.24%)
Mutual labels:  slider, carousel
React Native Carousel View
react-native carousel, support in both Android and iOS
Stars: ✭ 70 (-40.68%)
Mutual labels:  slider, carousel
Splide
Splide is a lightweight, powerful and flexible slider and carousel, written in pure JavaScript without any dependencies.
Stars: ✭ 786 (+566.1%)
Mutual labels:  slider, carousel
Slidetoact
A simple 'Slide to Unlock' Material widget for Android, written in Kotlin 📱🎨🦄
Stars: ✭ 783 (+563.56%)
Mutual labels:  hacktoberfest, slider
Hammer Slider
DISCONTINUED - HammerSlider touch is a lightweight infinite carousel plugin.
Stars: ✭ 21 (-82.2%)
Mutual labels:  slider, carousel
Orbit
React components of open-source Orbit design system by Kiwi.com
Stars: ✭ 774 (+555.93%)
Mutual labels:  hacktoberfest, component
Slendr
A responsive & lightweight (2KB gzipped) slider for modern browsers. [UNMAINTAINED]
Stars: ✭ 39 (-66.95%)
Mutual labels:  component, slider
React Accessible Accordion
Accessible Accordion component for React
Stars: ✭ 610 (+416.95%)
Mutual labels:  hacktoberfest, component
Swiper
Most modern mobile touch slider with hardware accelerated transitions
Stars: ✭ 29,519 (+24916.1%)
Mutual labels:  slider, carousel
Tiny Swiper
Ingenious JavaScript Carousel powered by wonderful plugins. Lightweight yet extensible. Import plugins as needed, No more, no less.
Stars: ✭ 1,061 (+799.15%)
Mutual labels:  slider, carousel

react-spring-slider

Hits-of-Code Version Minified Size Minified Zipped Size License

  1. General
  2. Installation
  3. Usage
  4. Configuration
  5. More Examples
  6. Contribution

General

This is a slider which uses react-spring under the hood.

This project aims to be flexible through configuration as well as be easy to use by sane and reasonable defaults.

You can have a real life look how this can be used within storybook (source) at: farbenmeer.github.io/react-spring-slider.

Installation

yarn add @farbenmeer/react-spring-slider
// OR
npm install --save @farbenmeer/react-spring-slider

Usage

The module provides a default export which you can import and use in your own component.

import Slider from "@farbenmeer/react-spring-slider";

const App = () => {
	return (
		<Slider>
			<div>child 1</div>
			<div>child 2</div>
			<div>child 3</div>
		</Slider>
	);
};

The slider can gain any children as long as there are a react node, so you can show images, text or some more complex components.

You can also use Typescript as the package contains type definitions.

Configuration

The slider currently provides the following interface:

Name Type Default Description
activeIndex number 0 Controlles the shown index
ArrowComponent function - A custom component for the arrows
auto number 0 0 = disabled auto sliding. Indicates the pausing time in milliseconds per slide before next slide is shown.
BulletComponent function - A custom component for the bullets
bulletStyle object { } custom styles for the bullets
children node [ ] The children of the slider, every child is a single slide
hasArrows boolean false Whether the slider should have arrows or not
hasBullets boolean false Whether the slider should have bullets or not
onSlideChange function - Callback which is triggered when the slides changed either manually or automatically
setSlideCustom function - A function to overwrite the default setSlide behavior.
slidesAtOnce number 1 A number which represents how many slides should be shown at once.

More examples

Custom bulletStyle

<Slider hasBullets bulletStyle={{ backgroundColor: "#fff" }}>
	<MySlide />
	<MySlide />
	<MySlide />
</Slider>

Fully customized

import Slider from "@farbenmeer/react-spring-slider";

const App = () => {
	const onSlideChange = (index) => console.log(`changed to slide ${index}`);
	const setSlideCustom = () => 1;

	const BulletComponent = ({ onClick, isActive }) => (
		<li
			style={{
				width: "25px",
				height: "25px",
				backgroundColor: "red",
				margin: "0 2px",
				opacity: isActive && "0.5",
			}}
			onClick={onClick}
		/>
	);

	BulletComponent.propTypes = {
		onClick: PropTypes.func.isRequired,
		isActive: PropTypes.bool.isRequired,
	};

	const ArrowComponent = ({ onClick, direction }) => {
		return (
			<div
				style={{
					border: "1px solid black",
					padding: "1em",
					backgroundColor: "white",
				}}
				onClick={onClick}
			>
				{direction}
			</div>
		);
	};

	ArrowComponent.propTypes = {
		onClick: PropTypes.func.isRequired,
		direction: PropTypes.string.isRequired,
	};

	return (
		<Slider
			activeIndex={2}
			slidesAtOnce={2}
			auto
			hasBullets
			BulletComponent={BulletComponent}
			ArrowComponent={ArrowComponent}
			onSlideChange={onSlideChange}
			setSlideCustom={setSlideCustom}
		>
			<div>child 1</div>
			<div>child 2</div>
			<div>child 3</div>
		</Slider>
	);
};

For more examples have a look at storybook (storybook source code).

Contribution

See CONTRIBUTING.md

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].