Carousel
Slide carousel with autoplay, loop, adaptive height, pill dots and an imperative ref.
import { Carousel } from '@lobehub/ui/base-ui';Data Display
Basic
Loading preview
APIs
Carousel properties
adaptiveHeightbooleanDefaults to
false.arrowsbooleanDefaults to
false.autoplaynumber | false | trueDefaults to
false.childrennull | string | number | bigint | false | true | ReactElement<unknown, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<AwaitedReactNode>defaultIndexnumberDefaults to
0.dotsbooleanDefaults to
true.indexnumberloopbooleanDefaults to
true.onIndexChange(index: number) => voidpauseOnHoverbooleanDefaults to
true.refnull | (instance: CarouselRef | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<CarouselRef | null>
Also accepts all native HTML and ARIA attributes.
Each child is a slide. autoplay takes true (5s) or an interval in ms and pauses while hovered unless pauseOnHover={false}. adaptiveHeight animates the viewport to the active slide's height. The ref exposes goTo(index), next() and prev(). Touch swipes change slides; inactive slides are inert.
Migrating from antd Carousel
beforeChange/afterChange→onIndexChange(index); controlledindexis supported.autoplaySpeed→autoplay={ms};dots={false}andref.goTokeep working.effect="fade",vertical,dotPosition,draggableand other slick settings are not supported.
Helpful?