Carousel Blazor API

Carousel Properties

NameTypeDefaultDescription
AutoPlayboolfalseThe items switch automatically if set to true or to a custom number(representing the timeout in milliseconds). This property works if slideShow property is enabled.
DataSourceIEnumerable<object>N/AAn array of objects. Each object defines an item. The following object properties are available:
  • label - a string representing the label of the item.
  • content - a string representing the content of the item
  • image - a string representing a url link to an image.
  • HTMLcontent - a string representing some HTML structure taht will be generated inside the item.
Delayint200Specifies the timeout before a slide changes when a navigation button is pressed. Navigation buttons are repeat buttons that will repeat the oepration after the delay is passed.
DisabledboolfalseEnables or disables the element.
DisableItemClickboolfalseDisabled the possibility to navigated to an item by clicking on item in displayMode 3d. By default users can navigate to items that are not currently active by clicking on them.
DisplayModeCarouselDisplayModeCarouselDisplayMode.DefaultDetermines the display mode.
HideArrowsboolfalseHides the navigation buttons.
HideIndicatorsboolfalseHides the slide indication panel that shows which item is currently in view (active item).
IndicatorTemplateobjectN/ACan be used to customize the slide indicator panel of the accordion. The property can be a string that represents the id of an HTMLTemplateElement in the DOM or it's direct reference.
Intervalint5000Determines the interval (in milliseconds) between a slide transitions when slideShow is enabled.
ItemTemplateobjectN/AUsed to completely customize the content of an item. The property can be a string that represents the id of an HTMLTemplateElement in the DOM or it's direct reference. The content of the template can contain property bindings that refer to the dataSource.
KeyboardboolfalseActivates/deactivates keyboard navigation. By default, items can not be navigated via keyboard
Localestring"en"Sets or gets the language. Used in conjunction with the property messages.
LoopboolfalseDetermines whether the the items should start over when the first or last item is reached.
MessagesobjectN/ASets or gets an object specifying strings used in the widget that can be localized. Used in conjunction with the property locale.
ReadonlyboolfalseIf the element is readonly, users cannot interact with it.
RightToLeftboolfalseSets or gets the value indicating whether the element is aligned to support locales using right-to-left fonts.
SlideShowboolfalseWhen slideShow property is set to true, the carousel changes the active slide automatically with a delay set in interval property.
SwipeboolfalseEnables or disables switching to the previous/next slide via swiping left/right. By default swiping is disabled.
Themestring""Determines the theme. Theme defines the look of the element
UnfocusableboolfalseIf is set to true, the element cannot be focused.
WheelboolfalseActivates/deactivates slide navigation via mouse wheel. By default it's disabled.

Carousel Methods

NameTypeArgumentsDescription
GetDataSourceAsync()Task<IEnumerable<object>>'N/A'Gets the &quot;DataSource&quot; property as Task&lt;IEnumerable&lt;object&gt;&gt;.
NextvoidN/ANavigates to the next slide.
PausevoidN/APauses the slide show if "slideShow" is enabled.
PlayvoidN/AStarts the slide show if "slideShow" is enabled.
PrevvoidN/ANavigates to the previous slide.
Refreshvoid'N/A'Refreshes the Blazor Component. Performs a layout of the HTML Elements and recalculates the measurements.
Rendervoid'N/A'Re-renders the Blazor Component. This method will make a full re-render.
SlideTovoidint indexNavigates to a specific slide with the given index.Args: int index - The index of the target slide.
StateHasChangedvoid'N/A'Refreshes the state and Re-renders the Blazor Component, if necessary.

Carousel Events

NameTypeDescriptionEvent Detail
OnChangeEventCallback<Event>Triggered when the active ( in view ) slide is changed.int index- The index of the new active slide., dynamic previousIndex- The index of the previous slide that was active.
Changedevent CarouselChangedEventHandlerTriggered when the active ( in view ) slide is changed.CarouselChangedEventArgs
OnChangingEventCallback<Event>Triggered when the process of slide changing starts.int index- The index of the new active slide., dynamic previousIndex- The index of the previous slide that was active.
Changingevent CarouselChangingEventHandlerTriggered when the process of slide changing starts.CarouselChangingEventArgs
OnSwipeleftEventCallback<Event>This event is triggered when the user swipes to the left inside the Carousel.N/A
SwipedLeftevent CarouselSwipedLeftEventHandlerThis event is triggered when the user swipes to the left inside the Carousel.CarouselSwipedLeftEventArgs
OnSwiperightEventCallback<Event>This event is triggered when the user swipes to the right inside the Carousel.N/A
SwipeRightevent CarouselSwipeRightEventHandlerThis event is triggered when the user swipes to the right inside the Carousel.CarouselSwipeRightEventArgs

Enums

CarouselDisplayMode

CarouselDisplayMode.Default
CarouselDisplayMode.Multiple
CarouselDisplayMode.Threed