Skip to content

Carousel

Horizontally scrolling set of slides with previous and next controls.

Installation

bun add @xerobi/ui
import { ArrowButton, Carousel, CarouselArrowBasicButtons, CarouselArrowFloatButtons, CarouselArrowNumberButtons, CarouselDotButtons, CarouselProgressBar, CarouselSlide, CarouselThumb, CarouselThumbs } from "@xerobi/ui/carousel"

This component is client-side. In Astro, hydrate it with a client directive.

API reference

ArrowButton

PropTypeDescription
svgSizenumber
variant*"prev" | "next"
svgIconstring | number | bigint | boolean | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>
options{ direction?: AxisDirectionOptionType | undefined; axis?: AxisOptionType | undefined; }
PropTypeDescription
carousel*{ pluginNames?: string[] | undefined; options?: CarouselOptions | undefined; mainRef: EmblaViewportRefType; mainApi?: EmblaCarouselType | undefined; thumbs: ...
slotProps{ container?: string | undefined; slide?: string | undefined; }

CarouselArrowBasicButtons

PropTypeDescription
disablePrev*boolean
disableNext*boolean
onClickPrev*() => void
onClickNext*() => void
totalSlidesnumber
selectedIndexnumber
options{ align?: AlignmentOptionType | undefined; axis?: AxisOptionType | undefined; container?: string | HTMLElement | null | undefined; slides?: string | HTMLElem...
slotProps{ prevBtn?: ArrowSlot | undefined; nextBtn?: ArrowSlot | undefined; }

CarouselArrowFloatButtons

PropTypeDescription
disablePrev*boolean
disableNext*boolean
onClickPrev*() => void
onClickNext*() => void
totalSlidesnumber
selectedIndexnumber
options{ align?: AlignmentOptionType | undefined; axis?: AxisOptionType | undefined; container?: string | HTMLElement | null | undefined; slides?: string | HTMLElem...
slotProps{ prevBtn?: ArrowSlot | undefined; nextBtn?: ArrowSlot | undefined; }

CarouselArrowNumberButtons

PropTypeDescription
disablePrev*boolean
disableNext*boolean
onClickPrev*() => void
onClickNext*() => void
totalSlidesnumber
selectedIndexnumber
options{ align?: AlignmentOptionType | undefined; axis?: AxisOptionType | undefined; container?: string | HTMLElement | null | undefined; slides?: string | HTMLElem...
slotProps{ prevBtn?: ArrowSlot | undefined; nextBtn?: ArrowSlot | undefined; }

CarouselDotButtons

PropTypeDescription
selectedIndex*number
scrollSnaps*number[]
onClickDot*(index: number) => void
gapnumber
variant"number" | "circular" | "rounded"
slotProps{ dot?: { size?: number | undefined; className?: string | undefined; style?: CSSProperties | undefined; } | undefined; }

CarouselProgressBar

PropTypeDescription
value*number

CarouselSlide

PropTypeDescription
options{ align?: AlignmentOptionType | undefined; axis?: AxisOptionType | undefined; container?: string | HTMLElement | null | undefined; slides?: string | HTMLElem...

CarouselThumb

PropTypeDescription
src*string
index*number
selected*boolean

CarouselThumbs

PropTypeDescription
options{ align?: AlignmentOptionType | undefined; axis?: AxisOptionType | undefined; container?: string | HTMLElement | null | undefined; slides?: string | HTMLElem...
slotProps{ slide?: string | undefined; container?: string | undefined; disableMask?: boolean | undefined; }

Hooks

  • useCarousel
  • useCarouselArrows
  • useCarouselAutoPlay
  • useCarouselAutoScroll
  • useCarouselDots
  • useCarouselProgress
  • useThumbs

Search documentation

Search pages, components and blocks.