Carousel
Horizontal carousel: touch drag (offset / velocity thresholds), autoplay (paused during
hover and dragging), loop wrapping and clamped boundary modes, dots indicator
(bottom / overlay) and desktop arrows. Page math fully consumes
@lh-ui/share/core/carousel.
Basic usage
Basic usage
水墨
页一
非循环受控当前页:0(方向键 ←/→ 也可翻页)
import { LhCarousel } from '@lh-ui/react'
export default function Demo() {
return <LhCarousel items={[<div>Page 1</div>, <div>Page 2</div>]} autoplay={3000} height={160} />
}
Carousel Props
| Prop | Description | Type | Options | Default |
|---|---|---|---|---|
| value | Current page index (controlled; uncontrolled self-driving when omitted) | number | — | — |
| autoplay | Autoplay interval ms (0 / omitted = off) | number | — | 0 |
| loop | Wrap-around | boolean | — | true |
| indicator | Indicator form | 'dots' | 'none' | — | 'dots' |
| indicatorPosition | Indicator position | 'bottom' | 'overlay' | — | 'bottom' |
| height | Height px | number | — | 200 |
| showArrow | Show prev/next arrows (desktop) | boolean | — | false |
| disabled | Disabled | boolean | — | false |
| ariaLabel | Accessible name (falls back to page announcement) | string | — | — |
| items | Page content array (one element per page) | ReactNode[] | — | — |
| onChange | Page changed | (value: number) => void | — | — |
| sx | Shorthand layout props | SxProps | — |