4.1.0 • Published 2 years ago

react-glide v4.1.0

Weekly downloads
155
License
MIT
Repository
github
Last release
2 years ago

react-glide

A lightweight, multi-purpose carousel component for React.

npm version CircleCI

demo

Installation

$ npm install react-glide

Usage

Import the module at the top of your component page:

import { Glide } from 'react-glide';
import 'react-glide/lib/reactGlide.css'

Glide functions as a wrapper and can be passed any type of element. See example folder:

<Glide height={500} width={500}>
  <img src='http:/path/to/image/url' />
  <img src='http:/path/to/image/url2' />
  <img src='http:/path/to/image1/url3' />
</Glide>

Options

Types

interface GlideProps {
  autoPlay?: boolean;
  autoPlaySpeed?: number;
  dots?: boolean;
  height?: number;
  infinite?: boolean;
  width: number;
  onSlideChange?: () => void;
}

Props Description

optiontypedescriptiondefaultrequired
widthintegerthe width of the carousel container.noneYes
heightintegerthe height of the carousel container.noneNo
autoPlayboolenables or disables autoPlay feature.falseNo
autoPlaySpeedintegerthe rate of change between slides, defined in ms.2000No
infiniteboolcarousel will loop infinitelytrueNo
dotsbooldot navigation & paginationtrueNo
onSlideChangefunca function that will fire when the slide changesnoneNo

Styles

Default Styles

To use the default styles, import the CSS from react-glide at the top of your file:

import 'react-glide/lib/reactGlide.css';

Overriding Default Styles

in order to fit the design of your project, you can override the default styles by using the class names below in your projects own stylesheet:

elementclass name
containers.glide--container
.glide--item
.glide--item.current
buttons.glide--next-btn
.glide--prev-btn
dots.glide--dots
.glide--dots-active
.glide--dots-inactive

Development

Install dependencies:

$ npm install

Run storybook at http://localhost:6006:

$ npm start

Run ssr test app at http://localhost:3000:

$ cd ./ssr-testing && npm i && npm start

Run tests in watch mode:

$ npm run test

Execute a single run of tests:

$ npm run test:once

Run linter check:

$ npm run lint:check

Run linter auto fix:

npm run lint:fix

License

MIT

4.1.0

2 years ago

4.1.0-alpha.1

2 years ago

3.2.1

2 years ago

4.0.0

2 years ago

3.2.0

5 years ago

3.1.0

5 years ago

3.0.0

5 years ago

2.0.0

7 years ago

1.4.0

7 years ago

1.3.1

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago