Skip to content
Document DB v7.2: Temporal Support, Telemetry Collection, All Calculations, String Based APIs, & Orleans Storage Providers! Feed The Machine Here

Carousel

Carousel<TItem> is a Blazor-only carousel built on a transform-based drag engine — click-and-drag on desktop, flick with momentum on touch — rather than native scroll-snap. It brings Embla-style behaviour to Blazor: alignment, slides-per-view, slides-to-scroll, variable widths, seamless looping, scroll-linked effects, autoplay / auto-scroll, and a counter, progress bar, and thumbnail strip.

For MAUI ↔ Blazor parity, use CarouselGallery instead. Use Carousel when you want the richer Blazor-only drag experience.

  • NuGet downloads for Shiny.Blazor.Controls
Frameworks
Blazor
  • Pointer drag engine — desktop click-drag and touch flick with friction/momentum; the container is translated by a single scroll position (no native scroll-snap).
  • AlignmentAlign settles the active slide at the Start, Center, or End of the viewport.
  • Slides per view / to scrollSlidesPerView sizes slides to fill the viewport; SlidesToScroll advances several at a time.
  • Variable widthsVariableWidths lets each slide size to its own content.
  • Vertical & RTLOrientation="Vertical" (with ViewportHeight) and Rtl for mirrored layout and drag.
  • Seamless loopLoop wraps around using per-slide repetition, so it works even with variable widths.
  • Drag freeDragFree gives momentum scrolling with no snapping.
  • Scroll-linked effectsEffect of Scale, Opacity, Parallax, or Fade, all driven by each slide’s distance from centre so they animate live while dragging.
  • Auto motion — discrete AutoPlay (with ShowProgress bar) or continuous AutoScroll marquee, both with PauseOnHover.
  • Chrome — arrows, dot indicators (one per snap), a ShowCounter “n / total” readout, and a ShowThumbnails navigation strip.
  • Lazy loading & keyboardLazyLoad defers off-screen item templates; arrow keys / Home / End navigate.
claude plugin marketplace add shinyorg/skills
claude plugin install shiny-client@shiny
BLE, GPS, Jobs, Notifications, Push, HTTP Transfers, OBD, Music, Health, DataSync — iOS, Android, Windows, MacOS, Linux, Web
claude plugin install shiny-maui@shiny
Shell, Contact Store
claude plugin install controls@shiny
TableView, BottomSheet, PillView, ImageViewer, Scheduler, Markdown, Mermaid Diagrams — MAUI and Blazor
claude plugin install shiny-mediator@shiny
Mediator/CQRS with middleware and source generators
claude plugin install shiny-data@shiny
DocumentDB and Spatial data libraries
claude plugin install shiny-aspire@shiny
Orleans and Gluetun Aspire integrations
claude plugin install shiny-extensions@shiny
DI, Stores, Reflector, Localization, Hosting modules
copilot plugin marketplace add https://github.com/shinyorg/skills
copilot plugin install shiny-client@shiny
BLE, GPS, Jobs, Notifications, Push, HTTP Transfers, OBD, Music, Health, DataSync — iOS, Android, Windows, MacOS, Linux, Web
copilot plugin install shiny-maui@shiny
Shell, Contact Store
copilot plugin install controls@shiny
TableView, BottomSheet, PillView, ImageViewer, Scheduler, Markdown, Mermaid Diagrams — MAUI and Blazor
copilot plugin install shiny-mediator@shiny
Mediator/CQRS with middleware and source generators
copilot plugin install shiny-data@shiny
DocumentDB and Spatial data libraries
copilot plugin install shiny-aspire@shiny
Orleans and Gluetun Aspire integrations
copilot plugin install shiny-extensions@shiny
DI, Stores, Reflector, Localization, Hosting modules
View Skills Repository
<Carousel TItem="Photo" Items="photos"
SlidesPerView="3" Align="CarouselAlign.Start" SlidesToScroll="3"
Loop="true"
Effect="CarouselEffect.Scale" FocusedItemScale="1" UnfocusedItemScale="0.8"
AutoPlay="true" AutoPlayInterval="3000"
ShowArrows="true" ShowCounter="true" ShowProgress="true"
@bind-CurrentPosition="snap"
ItemSelected="OnSelected">
<ItemTemplate Context="p">
<img src="@p.Url" alt="@p.Title" />
</ItemTemplate>
</Carousel>
@code {
List<Photo> photos = [];
int snap;
void OnSelected(Photo p) { }
}
PropertyTypeDefaultDescription
ItemsIReadOnlyList<TItem>Collection of items to display
ItemTemplateRenderFragment<TItem>Template for each slide
ThumbnailTemplateRenderFragment<TItem>Template for the thumbnail strip
PlaceholderTemplate / EmptyTemplateRenderFragmentLazy-load placeholder and empty-state content
EffectCarouselEffectNoneScroll-linked effect: None / Scale / Opacity / Parallax / Fade
AlignCarouselAlignCenterWhere the active slide settles: Start / Center / End
OrientationCarouselOrientationHorizontalHorizontal or Vertical (vertical uses ViewportHeight)
SlidesPerViewdouble?nullSlides visible at once (slides fill the viewport when set)
SlidesToScrollint1Slides advanced per arrow/dot step
VariableWidthsboolfalseSlides size to their own content
ItemWidth / ItemHeightdouble280 / 320Fixed slide size (px) when SlidesPerView is unset
ItemSpacingdouble16Gap between slides (px)
ViewportHeightdouble320Viewport height for vertical carousels (px)
LoopbooltrueSeamless wrap-around
RtlboolfalseMirrored layout + drag (horizontal only)
DraggablebooltrueEnable pointer drag
DragFreeboolfalseMomentum scrolling with no snap
AutoPlay / AutoPlayIntervalbool / intfalse / 4000Discrete timed advance (ms)
AutoScroll / AutoScrollSpeedbool / doublefalse / 40Continuous marquee scroll (px/s)
PauseOnHoverbooltruePause auto-motion on hover/focus
FocusedItemScale / UnfocusedItemScaledouble1.0 / 0.82Scale endpoints for the Scale effect
ParallaxFactordouble0.4Intensity of the Parallax effect
MinOpacitydouble0.18Floor for the Opacity effect
ShowArrows / ShowIndicatorsbooltruePrev/next buttons; dots (one per snap)
ShowCounter / ShowProgress / ShowThumbnailsboolfalse”n / total” readout; scroll-position bar; thumbnail strip
LazyLoad / LazyLoadBufferbool / intfalse / 1Defer item templates outside the buffer
CurrentPositionint0Selected snap index (TwoWay)

Methods:

  • NextAsync() / PreviousAsync() — step one snap
  • GoToAsync(snapIndex) — scroll to a snap
  • GoToSlideAsync(itemIndex) — scroll to the snap containing a specific item

Events:

  • CurrentPositionChanged (EventCallback<int>) — the selected snap changed (drag, settle, autoplay)
  • ItemSelected (EventCallback<TItem>) — the user clicked/tapped an item
  • Dots and the counter are keyed to snap points, not raw items — with SlidesToScroll > 1 there are fewer snaps than slides.
  • Effects are continuous: a slide at the centre is fully focused and blends toward the off-centre value as it moves, so dragging shows the effect mid-transition.
  • Loop repositions each slide to its nearest repetition off-screen, so wrap-around stays seamless with mixed slide widths (needs enough slides to fill the viewport plus the wrap distance).
  • A drag that moves past a small threshold suppresses the click that follows, so dragging never fires ItemSelected.
  • The engine re-measures on resize and keeps the selected snap aligned.