Kebechet.Blazor.Swiper 14.0.6

Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package Kebechet.Blazor.Swiper --version 14.0.6
                    
NuGet\Install-Package Kebechet.Blazor.Swiper -Version 14.0.6
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Kebechet.Blazor.Swiper" Version="14.0.6" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Kebechet.Blazor.Swiper" Version="14.0.6" />
                    
Directory.Packages.props
<PackageReference Include="Kebechet.Blazor.Swiper" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Kebechet.Blazor.Swiper --version 14.0.6
                    
#r "nuget: Kebechet.Blazor.Swiper, 14.0.6"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Kebechet.Blazor.Swiper@14.0.6
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Kebechet.Blazor.Swiper&version=14.0.6
                    
Install as a Cake Addin
#tool nuget:?package=Kebechet.Blazor.Swiper&version=14.0.6
                    
Install as a Cake Tool

"Buy Me A Coffee"

Blazor.Swiper

NuGet Version NuGet Downloads Build codecov Storybook Last updated Twitter

A Blazor wrapper for Swiper, built on the framework-agnostic Swiper Element web component. The Swiper bundle is shipped inside the package and auto-registered on startup - no npm build step and no manual <script> tags.

Live storybook - interactive stories for every option.

Installation

dotnet add package Kebechet.Blazor.Swiper

Usage

@using Kebechet.Blazor.Swiper

<Swiper Options="new() { Pagination = true, AllowSlidePrev = true }">
    <SwiperSlide>Slide 1</SwiperSlide>
    <SwiperSlide>Slide 2</SwiperSlide>
    <SwiperSlide>Slide 3</SwiperSlide>
</Swiper>

Styling the shadow-DOM controls (pagination, arrows) is done via Swiper's CSS parts / variables - see the demo.

Any attribute you put on <Swiper> or <SwiperSlide> that isn't a parameter is forwarded to the underlying <swiper-container> / <swiper-slide> element, so class, style and id work as usual.

Options

SwiperOptions is a strongly-typed subset of Swiper's parameters. Nullable members that are left unset keep Swiper's own default.

Option Type Default Description
Direction string horizontal Slider axis - use the SwiperDirection constants.
SlidesPerView double? 1 Number of slides visible at once.
SpaceBetween int? 0 Gap between slides, in px.
Loop bool false Continuous loop mode.
CenteredSlides bool false Center the active slide.
AutoHeight bool false Track height follows the active slide's content height.
InitialSlide int? 0 Slide shown first.
Speed int? 300 Transition duration, in ms.
AllowSlideNext bool true Allow moving to the next slide.
AllowSlidePrev bool true Allow moving to the previous slide.
AllowTouchMove bool true Allow touch/drag swiping at all.
Pagination bool false Show the built-in pagination bullets.
Navigation bool false Show the built-in prev/next arrows.
Scrollbar bool false Show the built-in scrollbar.
Keyboard bool false Enable keyboard control.
Mousewheel bool false Enable mousewheel control.
Observer bool false Swiper's MutationObserver, which auto-calls update() on any DOM change in the container. See below.
CssMode bool false Use the browser's native CSS Scroll Snap API instead of JS transforms. See below.

Observer is off by default

Swiper Element turns its MutationObserver on by default; this wrapper turns it off. With a framework re-rendering slide content - and especially with AutoHeight, whose height writes are themselves DOM mutations - it drives a costly update/height feedback loop. Call Update() explicitly instead when the slide collection changes, or set Observer = true if you want Swiper's behaviour back.

CssMode trades features for smoothness

CssMode = true moves the slider onto the browser's native CSS Scroll Snap API, so scrolling runs on the compositor thread - dramatically smoother for heavy or tall slides. In exchange (these are Swiper's own limitations, not the wrapper's):

  • mouse-drag does not work - wheel, trackpad and touch still do, exactly like a native scroller
  • Speed is ignored
  • transition start/end events do not fire, so use OnSlideChange rather than OnTransitionEnd
  • it is not compatible with Loop

Events

Parameter Type Raised when
OnSlideChange EventCallback<int> The slide changes; the argument is the new active index.
OnReachBeginning EventCallback The first slide is reached.
OnReachEnd EventCallback The last slide is reached.
OnReady EventCallback Swiper has initialized and positioned its initial slide.
OnTransitionEnd EventCallback A transition finishes, i.e. the slider has settled at rest.
<Swiper Options="new() { Pagination = true }"
        OnSlideChange="index => _current = index"
        OnReachEnd="() => _atEnd = true">
    <SwiperSlide>Slide 1</SwiperSlide>
    <SwiperSlide>Slide 2</SwiperSlide>
</Swiper>

Programmatic control

Capture the component with @ref and drive it from C#. ActiveIndex is kept in sync with the underlying Swiper.

Member Description
ActiveIndex The active slide index (read-only).
SlideTo(int index, int? speed = null) Transition to the slide at index.
SlideNext(int? speed = null) Transition to the next slide.
SlidePrev(int? speed = null) Transition to the previous slide.
Update() Recalculate Swiper after slides were added or removed.
SetAllowSlideNext(bool value) Enable/disable moving forward at runtime.
SetAllowSlidePrev(bool value) Enable/disable moving backward at runtime.
<Swiper @ref="_swiper" Options="new() { AllowTouchMove = false }">
    <SwiperSlide>Slide 1</SwiperSlide>
    <SwiperSlide>Slide 2</SwiperSlide>
</Swiper>

<button @onclick="() => _swiper!.SlideNext()">Next</button>

@code {
    private Swiper? _swiper;
}

Every method is a no-op until the component has rendered and its JS module has loaded, so calling one before OnReady does nothing.

Vertical direction needs a height

A vertical Swiper (Direction = SwiperDirection.Vertical) sizes its slides from the <Swiper> element's own height, which defaults to its content height. Give the <Swiper> an explicit height, or it collapses and slides stack:

<Swiper Options="new() { Direction = SwiperDirection.Vertical }" style="height: 300px;">
    ...
</Swiper>

License

MIT

Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
14.0.6.2 161 7/30/2026
14.0.6.1 107 7/26/2026
14.0.6 101 7/25/2026

Initial release wrapping Swiper 14.0.6 via the Swiper Element web component.