Carousel (WIP)
carousel functional composition and current verification limits.
Ordinary demos on this page explicitly use Shadcn Rhea, with matching examples. This does not change public compatibility defaults or imply complete browser, native-host or visual acceptance. Neutral Surface/Text atoms retain their own public semantics; the consumer composition supplies the family presentation theme.
Carousel composes an equal-size slide strip, a continuously scrollable viewport and Previous/Next controls. Pointer or touch dragging moves the strip before release; wheel, trackpad and scrollbar scrolling use the same surface. Releasing a drag or finishing native scrolling snaps to the nearest reachable item boundary. Keyboard navigation uses the same index requests.
This is a WIP source checkpoint. Full Adapter/Compiler, native GPUI, package consumer, accessibility and commit-bound visual acceptance remain pending.
Responsive viewport and controlled index
Section titled “Responsive viewport and controlled index”Set Root slidesPerView to the maximum equal items to display (default 1) and minSlideSize to their minimum extent in logical host pixels (default 0). The demo requests two items with a minimum extent of 180; narrowing the viewport reduces the actual capacity, including partial items. All slides retain their layout extent. Root exposes visibleSlides and maxIndex from the observed viewport, and the final snap aligns the strip end without leaving empty space.
A provided index selects controlled mode. indexChange proposes the new snap index. While dragging, the committed index stays unchanged; release uses synchronous owner acceptance or returns to the existing index. A later owner update moves the viewport when it arrives. Viewport exposes dragging, scrolling and normalized scrollPosition; Slide current follows the committed snap, while hidden follows actual offscreen visibility without removing the slide from layout.
orientation="vertical" requires an explicitly bounded viewport height. Horizontal direction="rtl" reverses physical dragging and arrow keys while retaining logical item order. Cancellation, disable, axis changes and removal discard unfinished dragging. loop wraps index requests between reachable ends; this slice does not clone slides for a seamless infinite strip. Autoplay and variable-size slides are outside the current contract.
Carousel is workspace source. There is no public proto-ui add target. Passing index selects controlled mode. Viewport has no props. Omitting Slide index uses its current anatomy order. Explicit indexes should match the item order.
| Prop | Type | Default |
|---|---|---|
index | number | — |
slidesPerView | number | 1 |
minSlideSize | number | 0 |
defaultIndex | number | 0 |
loop | boolean | false |
disabled | boolean | false |
orientation | 'horizontal' 'vertical' | horizontal |
direction | 'ltr' 'rtl' | ltr |
a11yLabel | string | Carousel |
These props belong to Root.