11# react-magic-slider-dots
22
33> React Magic Slider Dots Component for React Slick Carousel
4- ##### * Inspired by Instagram*
4+
5+ ##### _ Inspired by Instagram_
56
67[ ![ NPM] ( https://img.shields.io/npm/v/react-magic-slider-dots.svg )] ( https://www.npmjs.com/package/react-magic-slider-dots ) [ ![ JavaScript Style Guide] ( https://img.shields.io/badge/code_style-standard-brightgreen.svg )] ( https://standardjs.com )
78
@@ -14,6 +15,7 @@ npm install --save react-magic-slider-dots
1415```
1516
1617⚠️ Also install react-slick and slick-carousel for css and font [ React Slick Documentation] ( https://github.com/akiran/react-slick )
18+
1719``` bash
1820npm install slick-carousel
1921npm install react-slick --save
@@ -26,72 +28,72 @@ import "slick-carousel/slick/slick-theme.css";
2628## Usage
2729
2830``` jsx
29- import React , { Component } from ' react'
30- import Slider from ' react-slick' ;
31- import ' slick-carousel/slick/slick.css' ;
32- import ' slick-carousel/slick/slick-theme.css' ;
33-
34- import MagicSliderDots from ' react-magic-slider-dots' ;
35- import ' react-magic-slider-dots/magic-dots.css' ;
36-
37- class App extends Component {
38-
39- render () {
40-
41- const settings = {
42- dots : true ,
43- arrows : true ,
44- infinite : false ,
45- speed : 500 ,
46- slidesToShow : 1 ,
47- slidesToScroll : 1 ,
48- appendDots : ( dots ) => {
49- return < MagicSliderDots dots = {dots} numDotsToShow = { 4 } dotWidth = { 30 } / >
50- }
51- };
52-
53- return ( < Slider { ... settings} >
54- < div >
55- < h3 > 1 < / h3 >
56- < / div>
57- < div >
58- < h3 > 2 < / h3 >
59- < / div>
60- < div >
61- < h3 > 3 < / h3 >
62- < / div>
63- < div >
64- < h3 > 4 < / h3 >
65- < / div>
66- < div >
67- < h3 > 5 < / h3 >
68- < / div>
69- < div >
70- < h3 > 6 < / h3 >
71- < / div>
72- < div >
73- < h3 > 7 < / h3 >
74- < / div>
75- < div >
76- < h3 > 8 < / h3 >
77- < / div >
78- < / Slider > )
79- }
80- }
31+ import React , { Component } from ' react' ;
32+ import Slider from ' react-slick' ;
33+ import ' slick-carousel/slick/slick.css' ;
34+ import ' slick-carousel/slick/slick-theme.css' ;
35+
36+ import MagicSliderDots from ' react-magic-slider-dots' ;
37+ import ' react-magic-slider-dots/dist /magic-dots.css' ;
38+
39+ class App extends Component {
40+ render () {
41+ const settings = {
42+ dots : true ,
43+ arrows : true ,
44+ infinite : false ,
45+ speed : 500 ,
46+ slidesToShow : 1 ,
47+ slidesToScroll : 1 ,
48+ appendDots : dots => {
49+ return < MagicSliderDots dots = {dots} numDotsToShow = { 4 } dotWidth = { 30 } / > ;
50+ }
51+ };
52+
53+ return (
54+ < Slider { ... settings} >
55+ < div >
56+ < h3 > 1 < / h3 >
57+ < / div >
58+ < div>
59+ < h3 > 2 < / h3 >
60+ < / div >
61+ < div>
62+ < h3 > 3 < / h3 >
63+ < / div >
64+ < div>
65+ < h3 > 4 < / h3 >
66+ < / div >
67+ < div>
68+ < h3 > 5 < / h3 >
69+ < / div >
70+ < div>
71+ < h3 > 6 < / h3 >
72+ < / div >
73+ < div>
74+ < h3 > 7 < / h3 >
75+ < / div >
76+ < div>
77+ < h3 > 8 < / h3 >
78+ < / div >
79+ < / Slider >
80+ );
81+ }
82+ }
8183```
8284
8385### API
8486
8587This a list of props that you can pass down to the component:
8688
87- | Property | Description | Default value | Type | Required |
88- | -------- | ----------- | ------------- | ---- | -------- |
89- | ` dots ` | array of HTML li elements representing the slider dot | | array | yes
90- | ` numDotsToShow ` | number of slider dots to show | | number | yes
91- | ` dotWidth ` | width, in pixels, of a slider dot including any margins/padding | | number | yes
92- | ` dotContainerClassName ` | class name of parent div | ` magic-dots slick-dots ` | string |
93- | ` activeDotClassName ` | class name of active slider dot | ` slick-active ` | string |
94- | ` prevNextDotClassName ` | class name of left-most (prev) and right-most (next) slider dot. | ` small ` | string |
89+ | Property | Description | Default value | Type | Required |
90+ | ----------------------- | ---------------------------------------------------------------- | ----------------------- | -- ---- | -------- |
91+ | ` dots ` | array of HTML li elements representing the slider dot | | array | yes |
92+ | ` numDotsToShow ` | number of slider dots to show | | number | yes |
93+ | ` dotWidth ` | width, in pixels, of a slider dot including any margins/padding | | number | yes |
94+ | ` dotContainerClassName ` | class name of parent div | ` magic-dots slick-dots ` | string |
95+ | ` activeDotClassName ` | class name of active slider dot | ` slick-active ` | string |
96+ | ` prevNextDotClassName ` | class name of left-most (prev) and right-most (next) slider dot. | ` small ` | string |
9597
9698## License
9799
0 commit comments