https://img.shields.io/badge/-Deprecated-redhttps://img.shields.io/badge/-Deprecated-red

⚠️

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:

import { Slider } from 'vtex.store-components'

You can use it in your code like a React component with the jsx tag: <Slider>.

<Slider
  ssrFallback={this.ssrFallback()}
  sliderSettings={sliderSettings}
  scrollByPage={isScrollByPage}
  defaultItemWidth={DEFAULT_SHELF_ITEM_WIDTH + gap}
>
  {...}
</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 nameTypeDescription
sliderSettingsSettingsThe slider settings
adaptToScreenBooleanMakes the items per page to adapt by the slider width
defaultItemWidthNumberDefault item width, it's necessary when the adaptToScreen is true
scrollByPageBooleanIf the scroll of items is by page or not
leftArrowClassesStringLeft arrow custom classes
rightArrowClassesStringRight arrow custom classes
dotsClassesStringDots custom classes
childrenNode!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 nameDescriptionComponent Source
arrowRightThe right arrow of the sliderindex
arrowLeftThe left arrow of the sliderindex
dotsThe slider dotsindex

Did this page help you?