Carousel

DCarousel + DCarouselItem wrap daisyUI's carousel / carousel-item: a native scroll-snap track with zero JavaScript.

How to move it: the scrollbar is hidden on purpose — drag the strip with the mouse/finger, press Shift + scroll wheel, or focus a photo and use the arrow keys. It is a plain scrolling container, so it works even in static SSR.
Horizontal
<DCarousel Class="w-full max-w-2xl rounded-box">
    @foreach (var id in new[] { 1015, 1025, 1039, 1043, 1050 })
    {
        <DCarouselItem Snap="DaisyCarouselSnap.Start">
            <img src="https://picsum.photos/id/@id/640/360" alt="Photo @id" class="h-56 w-auto object-cover rounded-box" />
        </DCarouselItem>
    }
</DCarousel>
Center snap— Snap alignment per item; the track can center each slide
<DCarousel Align="DaisyCarouselAlign.Center" Class="w-full max-w-2xl rounded-box">
    @foreach (var id in new[] { 1062, 1069, 1074, 1080, 1084 })
    {
        <DCarouselItem Snap="DaisyCarouselSnap.Center">
            <img src="https://picsum.photos/id/@id/480/320" alt="Photo @id" class="h-44 w-auto object-cover rounded-box opacity-90" />
        </DCarouselItem>
    }
</DCarousel>
Vertical— carousel-vertical + a fixed height; items snap top-to-bottom
<DCarousel Vertical="true" Align="DaisyCarouselAlign.Center" Class="w-64 rounded-box" Style="height: 16rem;">
    @foreach (var id in new[] { 110, 111, 112, 113, 114 })
    {
        <DCarouselItem Snap="DaisyCarouselSnap.Center">
            <img src="https://picsum.photos/id/@id/480/256" alt="Photo @id" class="w-full object-cover rounded-box" />
        </DCarouselItem>
    }
</DCarousel>
Tips
  • No scrollbars needed for the demo — but a snap-always class on snap-start items makes flicks land exactly on a slide.
  • Items are arbitrary content; add captions with absolute positioning inside the item.

API

DCarousel

Parameters

Name Type Default Binding Description
Vertical bool False — Stack items vertically instead of horizontally ( carousel-vertical ).
Align DaisyCarouselAlign Default — Snap alignment of the track ( carousel-center / carousel-end ).
DefaultCenterEnd
ChildContent RenderFragment — — The carousel items.
Class string — — Additional CSS classes appended to the component's computed daisyUI classes.
Style string — — Inline styles applied to the root element.
DCarouselItem

Parameters

Name Type Default Binding Description
Snap DaisyCarouselSnap None — Where this item stops when the carousel scrolls ( snap-start etc.).
NoneStartCenterEnd
ChildContent RenderFragment — — Item content (typically an image).
Class string — — Additional CSS classes appended to the component's computed daisyUI classes.
Style string — — Inline styles applied to the root element.
Connection lost — reconnecting…
Connection failed.
The server has stopped.