0.1.7 • Published 10 months ago

react-styled-slider-component v0.1.7

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

React Styled Slider Component

A customizable and reusable slider component built with React and styled-components. This component allows developers to easily implement a slider/carousel with various configuration options, such as the number of visible slides, navigation arrows, dots, and different directions.

Installation

To install the package, use npm or yarn:

npm install react-styled-slider-component

Usage

Here's how to use the slider component in your React application:

import React from 'react';
import {Slider} from 'react-styled-slider-component';

const App: React.FC = () => {
  return (
    <div>
      <Slider
        visibleSlides={2}
        showDots={true}
        showArrows={true}
        dotsPosition="bottom"
        slideStep={1}
        direction="horizontal"
        arrowStyle="minimal"
      >
        <div style={{ backgroundColor: 'red', height: '200px' }}>Slide 1</div>
        <div style={{ backgroundColor: 'blue', height: '200px' }}>Slide 2</div>
        <div style={{ backgroundColor: 'green', height: '200px' }}>Slide 3</div>
        <div style={{ backgroundColor: 'yellow', height: '200px' }}>Slide 4</div>
        <div style={{ backgroundColor: 'red', height: '200px' }}>Slide 5</div>
        <div style={{ backgroundColor: 'blue', height: '200px' }}>Slide 6</div>
        <div style={{ backgroundColor: 'green', height: '200px' }}>Slide 7</div>
        <div style={{ backgroundColor: 'yellow', height: '200px' }}>Slide 8</div>
      </Slider>
    </div>
  );
};

export default App;

Props

The Slider component accepts the following props:

Prop NameTypeDefaultDescription
childrenReact.ReactNode[]-The slides to be displayed in the slider.
visibleSlidesnumber1Number of slides visible at one time.
showDotsbooleantrueWhether to show navigation dots below the slider.
showArrowsbooleantrueWhether to show navigation arrows on the slider.
dotsPosition'top' ,'bottom' , 'left' , 'right''bottom'Position of the navigation dots.
slideStepnumber1Number of slides to move on each navigation action.
direction'horizontal' , 'vertical''horizontal'Direction of the slider, either horizontal or vertical.
arrowStyle'minimal' , 'filled' , 'outlined''minimal'Style of the navigation arrows.
arrowColor'black' , 'white''black'Color of the navigation arrows.

Customization

The slider component uses styled-components for styling, making it highly customizable. You can override the styles by extending the styled components used in the slider.

Contributing

Contributions are welcome! Please open an issue or submit a pull request if you have any suggestions or improvements.

0.1.7

10 months ago

0.1.6

10 months ago

0.1.5

10 months ago

0.1.4

10 months ago

0.1.3

10 months ago

0.1.2

10 months ago

0.1.1

10 months ago

0.1.0

10 months ago