Optional_Optionala11yObject with a11y parameters or boolean true to enable with default settings.
OptionalallowSet to false to disable swiping to next slide direction (to right or bottom)
OptionalallowSet to false to disable swiping to previous slide direction (to left or top)
OptionalallowIf false, then the only way to switch the slide is use of external API functions like slidePrev or slideNext
OptionalautoSet to true and slider wrapper will adapt its height to the height of the currently active slide
OptionalautoplayObject with autoplay parameters or boolean true to enable with default settings
OptionalbreakpointsAllows to set different parameter for different responsive breakpoints (screen sizes). Not all parameters can be changed in breakpoints, only those which do not require different layout and logic, like slidesPerView, slidesPerGroup, spaceBetween, grid.rows. Such parameters like loop and effect won't work
const swiper = new Swiper('.swiper', {
// Default parameters
slidesPerView: 1,
spaceBetween: 10,
// Responsive breakpoints
breakpoints: {
// when window width is >= 320px
320: {
slidesPerView: 2,
spaceBetween: 20
},
// when window width is >= 480px
480: {
slidesPerView: 3,
spaceBetween: 30
},
// when window width is >= 640px
640: {
slidesPerView: 4,
spaceBetween: 40
}
}
})
OptionalbreakpointsBase for breakpoints (beta). Can be window or container. If set to window (by default) then breakpoint keys mean window width. If set to container then breakpoint keys treated as swiper container width
OptionalcardsObject with Cards-effect parameters
OptionalcenteredIf true, then active slide will be centered, not always on the left side.
OptionalcenteredIf true, then active slide will be centered without adding gaps at the beginning and end of slider.
Required centeredSlides: true. Not intended to be used with loop or pagination
OptionalcenterWhen enabled it center slides if the amount of slides less than slidesPerView. Not intended to be used loop mode and grid.rows
OptionalcontainerThe beginning of the modifier CSS class that can be added to swiper container depending on different parameters
OptionalcontrollerObject with controller parameters or boolean true to enable with default settings
OptionalcoverflowObject with Coverflow-effect parameters.
OptionalcreateWhen enabled Swiper will automatically wrap slides with swiper-wrapper element,
and will create required elements for navigation, pagination and scrollbar
they are enabled (with their respective params object or with boolean true))
OptionalcreativeObject with Creative-effect parameters
OptionalcssWhen enabled it will use modern CSS Scroll Snap API. It doesn't support all of Swiper's features, but potentially should bring a much better performance in simple configurations.
This is what is not supported when it is enabled:
speed parameter may not have no effectslideChange instead)slidesPerGroup has limited supportsimulateTouch doesn't have effect and "dragging" with mouse doesn't workresistance doesn't have any effectallowSlidePrev/NextswipeHandlerIn case if you use it with other effects, especially 3D effects, it is required to wrap slide's content with <div class="swiper-slide-transform"> element. And if you use any custom styles on slides (like background colors, border radius, border, etc.), they should be set on swiper-slide-transform element instead.
<div class="swiper">
<div class="swiper-wrapper">
<div class="swiper-slide">
<!-- wrap slide content with transform element -->
<div class="swiper-slide-transform">
... slide content ...
</div>
</div>
...
</div>
</div>
<script>
const swiper = new Swiper('.swiper', {
effect: 'flip',
cssMode: true,
});
</script>
OptionalcubeObject with Cube-effect parameters
OptionaldirectionCan be 'horizontal' or 'vertical' (for vertical slider).
OptionaledgeEnable to release Swiper events for swipe-back work in app. If set to 'prevent' then it will prevent system swipe-back navigation instead. This feature works only with "touch" events (and not pointer events), so it will work on iOS/Android devices and won't work on Windows devices with pointer (touch) events.
OptionaledgeArea (in px) from left edge of the screen to release touch events for swipe-back in app
OptionaleffectTransition effect. Can be 'slide', 'fade', 'cube', 'coverflow', 'flip', 'creative' or 'cards'
OptionalenabledWhether Swiper initially enabled. When Swiper is disabled, it will hide all navigation elements and won't respond to any events and interactions
OptionaleventsEvent name prefix for all DOM events emitted by Swiper Element (web component)
OptionalfadeObject with Fade-effect parameters
OptionalflipObject with Flip-effect parameters
OptionalfocusableCSS selector for focusable elements. Swiping will be disabled on such elements if they are "focused"
OptionalfollowIf disabled, then slider will be animated only when you release it, it will not move while you hold your finger on it
OptionalfreeEnables free mode functionality. Object with free mode parameters or boolean true to enable with default settings.
OptionalgrabThis option may a little improve desktop usability. If true, user will see the "grab" cursor when hover on Swiper
OptionalgridObject with grid parameters to enable "multirow" slider.
OptionalhashEnables hash url navigation to for slides.
Object with hash navigation parameters or boolean true to enable with default settings
OptionalheightSwiper height (in px). Parameter allows to force Swiper height. Useful only if you initialize Swiper when it is hidden and in SSR and Test environments for correct Swiper initialization
OptionalhistoryEnables history push state where every slide will have its own url. In this parameter you have to specify main slides url like "slides" and specify every slide url using data-history attribute.
Object with history navigation parameters or boolean true to enable with default settings
OptionalinitWhether Swiper should be initialised automatically when you create an instance.
If disabled, then you need to init it manually by calling swiper.init()
OptionalinitialIndex number of initial slide.
OptionalinjectInject text styles to the shadow DOM. Only for usage with Swiper Element
OptionalinjectInject styles <link>s to the shadow DOM. Only for usage with Swiper Element
OptionalkeyboardEnables navigation through slides using keyboard. Object with keyboard parameters or boolean true to enable with default settings
OptionallazyCSS class name of lazy preloader
OptionallazyNumber of next and previous slides to preload. Only applicable if using lazy loading.
OptionallongSet to false if you want to disable long swipes
OptionallongMinimal duration (in ms) to trigger swipe to next/previous slide during long swipes
OptionallongRatio to trigger swipe to next/previous slide during long swipes
OptionalloopSet to true to enable continuous loop mode
Because of nature of how the loop mode works (it will rearrange slides), total number of slides must be:
slidesPerView + slidesPerGroupslidesPerGroup (or use loopAddBlankSlides parameter)grid.rows (or use loopAddBlankSlides parameter)OptionalloopAutomatically adds blank slides if you use Grid or slidesPerGroup and the total amount of slides is not even to slidesPerGroup or to grid.rows
OptionalloopAllows to increase amount of looped slides
OptionalloopIf enabled then slideNext/Prev will do nothing while slider is animating in loop mode
OptionalmaxIf total number of slides less than specified here value, then Swiper will enable backface-visibility: hidden on slide elements to reduce visual "flicker" in Safari.
OptionalmodulesArray with Swiper modules
OptionalmousewheelEnables navigation through slides using mouse wheel. Object with mousewheel parameters or boolean true to enable with default settings
OptionalnavigationObject with navigation parameters or boolean true to enable with default settings.
OptionalnestedSet to true on Swiper for correct touch events interception. Use only on
swipers that use same direction as the parent one
OptionalnormalizeNormalize slide index.
OptionalnoEnable/disable swiping on elements matched to class specified in noSwipingClass
OptionalnoSpecify noSwiping's element css class
OptionalnoCan be used instead of noSwipingClass to specify elements to disable swiping on.
For example 'input' will disable swiping on all inputs
OptionalobserveSet to true if you also need to watch Mutations for Swiper parent elements
OptionalobserverSet to true to enable Mutation Observer on Swiper and its elements. In this case Swiper will be updated (reinitialized) each time if you change its style (like hide/show) or modify its child elements (like adding/removing slides)
OptionalobserveSet to true if you also need to watch Mutations for Swiper slide children elements
OptionalonRegister event handlers
Optional_beforeBreakpoint?: (swiper: SwiperClass, breakpointParams: SwiperOptions) => void!INTERNAL: Event will fired right before breakpoint change
Optional_containerClasses?: (swiper: SwiperClass, classNames: string) => void!INTERNAL: Event will fired after setting CSS classes on swiper container element
Optional_freeModeNoMomentumRelease?: (swiper: SwiperClass) => void!INTERNAL: Event will be fired on free mode touch end (release) and there will no be momentum
Optional_slideClass?: (swiper: SwiperClass, slideEl: HTMLElement, classNames: string) => void!INTERNAL: Event will fired after setting CSS classes on swiper slide element
Optional_slideClasses?: (!INTERNAL: Event will fired after setting CSS classes on all swiper slides
Optional_swiper?: (swiper: SwiperClass) => void!INTERNAL: Event will fired as soon as swiper instance available (before init)
OptionalactiveIndexChange?: (swiper: SwiperClass) => voidEvent will fired on active index change
OptionalafterInit?: (swiper: SwiperClass) => voidEvent will fired right after initialization
Optionalautoplay?: (swiper: SwiperClass) => voidEvent will be fired when slide changed with autoplay
OptionalautoplayPause?: (swiper: SwiperClass) => voidEvent will be fired on autoplay pause
OptionalautoplayResume?: (swiper: SwiperClass) => voidEvent will be fired on autoplay resume
OptionalautoplayStart?: (swiper: SwiperClass) => voidEvent will be fired in when autoplay started
OptionalautoplayStop?: (swiper: SwiperClass) => voidEvent will be fired when autoplay stopped
OptionalautoplayTimeLeft?: (swiper: SwiperClass, timeLeft: number, percentage: number) => voidEvent triggers continuously while autoplay is enabled. It contains time left (in ms) before transition to next slide and percentage of that time related to autoplay delay
OptionalbeforeDestroy?: (swiper: SwiperClass) => voidEvent will be fired right before Swiper destroyed
OptionalbeforeInit?: (swiper: SwiperClass) => voidEvent will fired right before initialization
OptionalbeforeLoopFix?: (swiper: SwiperClass) => voidEvent will be fired right before "loop fix"
OptionalbeforeResize?: (swiper: SwiperClass) => voidEvent will fired before resize handler
OptionalbeforeSlideChangeStart?: (swiper: SwiperClass) => voidEvent will fired before slide change transition start
OptionalbeforeTransitionStart?: (swiper: SwiperClass, speed: number, internal: any) => voidEvent will fired before transition start
Optionalbreakpoint?: (swiper: SwiperClass, breakpointParams: SwiperOptions) => voidEvent will be fired on breakpoint change
OptionalchangeDirection?: (swiper: SwiperClass) => voidEvent will fired on direction change
Optionalclick?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user click/tap on Swiper. Receives pointerup event as an arguments.
Optionaldestroy?: (swiper: SwiperClass) => voidEvent will be fired on swiper destroy
OptionaldoubleClick?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user double click/tap on Swiper
OptionaldoubleTap?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user double tap on Swiper's container. Receives pointerup event as an arguments
OptionalfromEdge?: (swiper: SwiperClass) => voidEvent will be fired when Swiper goes from beginning or end position
OptionalhashChange?: (swiper: SwiperClass) => voidEvent will be fired on window hash change
OptionalhashSet?: (swiper: SwiperClass) => voidEvent will be fired when swiper updates the hash
Optionalinit?: (swiper: SwiperClass) => anyFired right after Swiper initialization.
OptionalkeyPress?: (swiper: SwiperClass, keyCode: string) => voidEvent will be fired on key press
Optionallock?: (swiper: SwiperClass) => voidEvent will be fired when swiper is locked (when watchOverflow enabled)
OptionalloopFix?: (swiper: SwiperClass) => voidEvent will be fired after "loop fix"
OptionalmomentumBounce?: (swiper: SwiperClass) => voidEvent will be fired on momentum bounce
OptionalnavigationHide?: (swiper: SwiperClass) => voidEvent will be fired on navigation hide
OptionalnavigationNext?: (swiper: SwiperClass) => voidEvent will be fired on navigation next button click
OptionalnavigationPrev?: (swiper: SwiperClass) => voidEvent will be fired on navigation prev button click
OptionalnavigationShow?: (swiper: SwiperClass) => voidEvent will be fired on navigation show
OptionalobserverUpdate?: (swiper: SwiperClass) => voidEvent will be fired if observer is enabled and it detects DOM mutations
Optionalorientationchange?: (swiper: SwiperClass) => voidEvent will be fired on orientation change (e.g. landscape -> portrait)
OptionalpaginationHide?: (swiper: SwiperClass) => voidEvent will be fired on pagination hide
OptionalpaginationRender?: (swiper: SwiperClass, paginationEl: HTMLElement) => voidEvent will be fired after pagination rendered
OptionalpaginationShow?: (swiper: SwiperClass) => voidEvent will be fired on pagination show
OptionalpaginationUpdate?: (swiper: SwiperClass, paginationEl: HTMLElement) => voidEvent will be fired when pagination updated
Optionalprogress?: (swiper: SwiperClass, progress: number) => voidEvent will be fired when Swiper progress is changed, as an arguments it receives progress that is always from 0 to 1
OptionalreachBeginning?: (swiper: SwiperClass) => voidEvent will be fired when Swiper reach its beginning (initial position)
OptionalreachEnd?: (swiper: SwiperClass) => voidEvent will be fired when Swiper reach last slide
OptionalrealIndexChange?: (swiper: SwiperClass) => voidEvent will fired on real index change
Optionalresize?: (swiper: SwiperClass) => voidEvent will be fired on window resize right before swiper's onresize manipulation
Optionalscroll?: (swiper: SwiperClass, event: WheelEvent) => voidEvent will be fired on mousewheel scroll
OptionalscrollbarDragEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired on draggable scrollbar drag end
OptionalscrollbarDragMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired on draggable scrollbar drag move
OptionalscrollbarDragStart?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired on draggable scrollbar drag start
OptionalsetTransition?: (swiper: SwiperClass, transition: number) => voidEvent will be fired everytime when swiper starts animation. Receives current transition duration (in ms) as an arguments
OptionalsetTranslate?: (swiper: SwiperClass, translate: number) => voidEvent will be fired when swiper's wrapper change its position. Receives current translate value as an arguments
OptionalslideChange?: (swiper: SwiperClass) => voidEvent will be fired when currently active slide is changed
OptionalslideChangeTransitionEnd?: (swiper: SwiperClass) => voidEvent will be fired after animation to other slide (next or previous).
OptionalslideChangeTransitionStart?: (swiper: SwiperClass) => voidEvent will be fired in the beginning of animation to other slide (next or previous).
OptionalslideNextTransitionEnd?: (swiper: SwiperClass) => voidSame as "slideChangeTransitionEnd" but for "forward" direction only
OptionalslideNextTransitionStart?: (swiper: SwiperClass) => voidSame as "slideChangeTransitionStart" but for "forward" direction only
OptionalslidePrevTransitionEnd?: (swiper: SwiperClass) => voidSame as "slideChangeTransitionEnd" but for "backward" direction only
OptionalslidePrevTransitionStart?: (swiper: SwiperClass) => voidSame as "slideChangeTransitionStart" but for "backward" direction only
OptionalslideResetTransitionEnd?: (swiper: SwiperClass) => voidEvent will be fired in the end of animation of resetting slide to current one
OptionalslideResetTransitionStart?: (swiper: SwiperClass) => voidEvent will be fired in the beginning of animation of resetting slide to current one
OptionalsliderFirstMove?: (swiper: SwiperClass, event: TouchEvent) => voidEvent will be fired with first touch/drag move
OptionalsliderMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user touch and move finger over Swiper and move it. Receives pointermove event as an arguments.
OptionalslidesGridLengthChange?: (swiper: SwiperClass) => voidEvent will be fired when slides grid has changed
OptionalslidesLengthChange?: (swiper: SwiperClass) => voidEvent will be fired when number of slides has changed
OptionalslidesUpdated?: (swiper: SwiperClass) => voidEvent will be fired after slides and their sizes are calculated and updated
OptionalsnapGridLengthChange?: (swiper: SwiperClass) => voidEvent will be fired when snap grid has changed
OptionalsnapIndexChange?: (swiper: SwiperClass) => voidEvent will fired on snap index change
Optionaltap?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user click/tap on Swiper. Receives pointerup event as an arguments.
OptionaltoEdge?: (swiper: SwiperClass) => voidEvent will be fired when Swiper goes to beginning or end position
OptionaltouchEnd?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user release Swiper. Receives pointerup event as an arguments.
OptionaltouchMove?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user touch and move finger over Swiper. Receives pointermove event as an arguments.
OptionaltouchMoveOpposite?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user touch and move finger over Swiper in direction opposite to direction parameter. Receives pointermove event as an arguments.
OptionaltouchStart?: (swiper: SwiperClass, event: MouseEvent | TouchEvent | PointerEvent) => voidEvent will be fired when user touch Swiper. Receives pointerdown event as an arguments.
OptionaltransitionEnd?: (swiper: SwiperClass) => voidEvent will be fired after transition.
OptionaltransitionStart?: (swiper: SwiperClass) => voidEvent will be fired in the beginning of transition.
Optionalunlock?: (swiper: SwiperClass) => voidEvent will be fired when swiper is unlocked (when watchOverflow enabled)
Optionalupdate?: (swiper: SwiperClass) => voidEvent will be fired after swiper.update() call
OptionalzoomChange?: (Event will be fired on zoom change
OptionaloneWhen enabled, will swipe slides only forward (one-way) regardless of swipe direction
OptionalpaginationObject with pagination parameters or boolean true to enable with default settings.
OptionalparallaxObject with parallax parameters or boolean true to enable with default settings.
OptionalpassivePassive event listeners will be used by default where possible to improve scrolling performance on mobile devices.
But if you need to use e.preventDefault and you have conflict with it, then you should disable this parameter
OptionalpreventSet to true to prevent accidental unwanted clicks on links during swiping
OptionalpreventSet to true to stop clicks event propagation on links during swiping
OptionalpreventWhen enabled it won't allow to change slides by swiping or navigation/pagination buttons during transition
OptionalresistanceSet to false if you want to disable resistant bounds
OptionalresistanceThis option allows you to control resistance ratio
OptionalresizeWhen enabled it will use ResizeObserver (if supported by browser) on swiper container to detect container resize (instead of watching for window resize)
OptionalrewindSet to true to enable "rewind" mode. When enabled, clicking "next" navigation button (or calling .slideNext()) when on last slide will slide back to the first slide. Clicking "prev" navigation button (or calling .slidePrev()) when on first slide will slide forward to the last slide.
OptionalroundSet to true to round values of slides width and height to prevent blurry texts on usual
resolution screens (if you have such)
OptionalrunFire Transition/SlideChange/Start/End events on swiper initialization. Such events will be fired on initialization in case of your initialSlide is not 0, or you use loop mode
OptionalscrollbarObject with scrollbar parameters or boolean true to enable with default settings.
OptionalsetEnabled this option and plugin will set width/height on swiper wrapper equal to total size of all slides. Mostly should be used as compatibility fallback option for browser that don't support flexbox layout well
OptionalshortSet to false if you want to disable short swipes
OptionalsimulateIf true, Swiper will accept mouse events like touch events (click and drag to change slides)
OptionalslideCSS class name of currently active slide
OptionalslideCSS class name of the blank slide added by the loop mode (when loopAddBlankSlides is enabled)
OptionalslideCSS class name of slide
OptionalslideCSS class name of fully (when whole slide is in the viewport) visible slide
OptionalslideCSS class name of slide which is right after currently active slide
OptionalslideCSS class name of slide which is right before currently active slide
OptionalslidesAdd (in px) additional slide offset in the end of the container (after all slides)
OptionalslidesAdd (in px) additional slide offset in the beginning of the container (before all slides)
OptionalslidesSet numbers of slides to define and enable group sliding. Useful to use with slidesPerView > 1
OptionalslidesThis param intended to be used only with slidesPerView: 'auto' and slidesPerGroup: 1. When enabled, it will skip all slides in view on .slideNext() & .slidePrev() methods calls, on Navigation "buttons" clicks and in autoplay.
OptionalslidesThe parameter works in the following way: If slidesPerGroupSkip equals 0 (default), no slides are excluded from grouping, and the resulting behaviour is the same as without this change.
If slidesPerGroupSkip is equal or greater than 1 the first X slides are treated as single groups, whereas all following slides are grouped by the slidesPerGroup value.
OptionalslidesNumber of slides per view (slides visible at the same time on slider's container).
OptionalslideSet to true and click on any slide will produce transition to this slide
OptionalslideCSS class name of currently/partially visible slide
OptionalspaceDistance between slides in px.
OptionalspeedDuration of transition between slides (in ms)
OptionalswipeString with CSS selector or HTML element of the container with pagination that will work as only available handler for swiping
OptionalswiperThe name of the swiper element node name; used for detecting web component rendering
OptionalthresholdThreshold value in px. If "touch distance" will be lower than this value then swiper will not move
OptionalthumbsObject with thumbs component parameters
OptionaltouchAllowable angle (in degrees) to trigger touch move
OptionaltouchTarget element to listen touch events on. Can be 'container' (to listen for touch events on swiper) or 'wrapper'
(to listen for touch events on swiper-wrapper)
OptionaltouchIf enabled, then propagation of "touchmove" will be stopped
OptionaltouchTouch ratio
OptionaltouchEnable to release touch events on slider edge position (beginning, end) to allow for further page scrolling. This feature works only with "touch" events (and not pointer events), so it will work on iOS/Android devices and won't work on Windows devices with pointer events. Also threshold parameter must be set to 0
OptionaltouchForce to always prevent default for touchstart (pointerdown) event
OptionaltouchIf disabled, pointerdown event won't be prevented
OptionaluniqueIf enabled (by default) and navigation elements' parameters passed as a string (like ".pagination")
then Swiper will look for such elements through child elements first.
Applies for pagination, prev/next buttons and scrollbar elements
OptionalupdateSwiper will recalculate slides position on window resize (orientationchange)
OptionalurlRequired for active slide detection when rendered on server-side and enabled history
OptionaluseruserAgent string. Required for browser/device detection when rendered on server-side
OptionalvirtualEnables virtual slides functionality. Object with virtual slides parameters or boolean true to enable with default settings.
OptionalvirtualEnabled this option and swiper will be operated as usual except it will not move, real translate values on wrapper will not be set. Useful when you may need to create custom slide transition
OptionalwatchWhen enabled Swiper will be disabled and hide navigation buttons on case there are not enough slides for sliding.
OptionalwatchEnable this feature to calculate each slides progress and visibility (slides in viewport will have additional visible class)
OptionalwidthSwiper width (in px). Parameter allows to force Swiper width. Useful only if you initialize Swiper when it is hidden and in SSR and Test environments for correct Swiper initialization
OptionalwrapperCSS class name of slides' wrapper
OptionalzoomEnables zooming functionality. Object with zoom parameters or boolean true to enable with default settings
!INTERNAL When enabled will emit "_containerClasses" and "_slideClass" events