Blazorise Carousel component

Loop a series of images or texts in a limited space.

Overview

The Carousel component in Blazorise is a versatile and dynamic user interface element that facilitates the display of sequential content. This could include images, text, or any other HTML elements arranged in individual CarouselSlide components. The Carousel seamlessly transitions from one slide to another, either through user interaction or automatically over time, providing an interactive and engaging method of content presentation. It's highly customizable, fitting various use cases from image galleries to text-based slideshows, making it a valuable component in any modern web application.

  • <Carousel> main container
    • <CarouselSlide> wrapper for slide content

Examples

Basic

A basic example of a Blazorise Carousel component includes multiple CarouselSlide components, each containing individual content. This Carousel displays one slide at a time, allowing users to navigate between the slides manually or automatically. Despite its simplicity, CarouselSlide components can house a variety of content, such as images, videos, or complex HTML structures.
<Carousel @bind-SelectedSlide="@selectedSlide">
    <CarouselSlide Name="1">
        <Image Source="img/gallery/1.jpg" Text="Lights image" Display="Display.Block" Width="Width.Is100" />
    </CarouselSlide>
    <CarouselSlide Name="2">
        <Image Source="img/gallery/2.jpg" Text="Keyboard image" Display="Display.Block" Width="Width.Is100" />
    </CarouselSlide>
    <CarouselSlide Name="3">
        <Image Source="img/gallery/3.jpg" Text="Road image" Display="Display.Block" Width="Width.Is100" />
    </CarouselSlide>
</Carousel>
@code{
    private string selectedSlide = "2";
}

Best Practices

Uniform Sizes

For optimal Carousel functionality in Blazorise, maintain uniform dimensions across all slides. Inconsistent sizes can cause disruptive resizing during transitions. This can be prevented by defining consistent widths and heights through additional CSS styles. Uniform slide dimensions provide a smoother user experience and a more visually appealing Carousel component.

API

Attributes

Name Description Type Default
Autoplay Autoplays the carousel slides from left to right. bool true
ShowIndicators Specifies whether to show an indicator for each slide. bool true
ShowControls Specifies whether to show the controls that allows the user to navigate to the next or previous slide. bool true
SelectedSlide Gets or sets currently selected slide name. string
SelectedSlideChanged Occurs after the selected slide has changed. EventCallback<string>
PreviousButtonLocalizer Function used to handle custom localization for previous button that will override a default ITextLocalizer. TextLocalizerHandler
NextButtonLocalizer Function used to handle custom localization for next button that will override a default ITextLocalizer. TextLocalizerHandler
AutoRepeat Auto-repeats the carousel slides once they reach the end. bool true
Crossfade Animate slides with a fade transition instead of a slide. bool false
Interval Defines the interval(in milliseconds) after which the item will automatically slide. double 2000
On this page