Warning
The Slider component has been deprecated in favor of the Slider Layout app. Although support for this component is still given, it's strongly recommended that you update your store theme with the Slider Layout's blocks in order to keep up with the component's evolution.
Slider
is a VTEX component that allows to show a collection of children components through a slide. To accomplish that, an external library called react-slick is used.
This component can be imported and used by any VTEX app.
Usage
You should follow the usage instruction in the main README.
To import it into your code:
_10import { Slider } from 'vtex.store-components'
You can use it in your code like a React component with the jsx tag: <Slider>
.
_10<Slider_10 ssrFallback={this.ssrFallback()}_10 sliderSettings={sliderSettings}_10 scrollByPage={isScrollByPage}_10 defaultItemWidth={DEFAULT_SHELF_ITEM_WIDTH + gap}_10>_10 {...}_10</Slider>
Configuration
Through the Storefront, you can change the Slider
's behavior and interface. However, you also can make in your theme app, as Store theme does.
Prop name | Type | Description |
---|---|---|
sliderSettings | Settings | The slider settings |
adaptToScreen | Boolean | Makes the items per page to adapt by the slider width |
defaultItemWidth | Number | Default item width, it's necessary when the adaptToScreen is true |
scrollByPage | Boolean | If the scroll of items is by page or not |
leftArrowClasses | String | Left arrow custom classes |
rightArrowClasses | String | Right arrow custom classes |
dotsClasses | String | Dots custom classes |
children | Node! | Array of items to be rendered inside the slider |
Settings:
For more information on the slider settings, access the official documentation og the react-slick library.
Styles API
You should follow the Styles API instruction in the main README.
CSS Namespaces
Below, we describe the namespace that are defined in the Slider
.
Class name | Description | Component Source |
---|---|---|
arrowRight | The right arrow of the slider | index |
arrowLeft | The left arrow of the slider | index |
dots | The slider dots | index |