Skip to content
ray·elements
Get startedFoundationsComponentsExtendingChartsraylang

Buttons

Inputs

Navigation

Overlays

Data display

Feedback

Layout

Theme

Buttons

Button Button group Icon button Toggle Toggle group

Inputs

Avatar picker (Profile picture, Photo picker) Checkbox Checkbox group Color picker Combobox (Multi select) Date picker File upload Image crop Input Knob (Rotary, Dial, Potentiometer) Mode input Number input Password input Path input (File path, Folder picker) Radio group Search Segmented control Select Slider (Range, Fader) Switch Tags input (Tag input, Chips input, TagsInput) Textarea

Navigation

Bottom nav Breadcrumbs Document tabs Nav link Pagination Sidebar Stepper Tabs

Overlays

Command palette Dialog (Modal) Drawer Menu Popover Tooltip

Data display

Accordion Attachment Avatar Badge Blockquote Carousel Code Icon Indicator Kbd Meter (Level meter, VU meter, Peak meter) QR code (QR, Barcode, 2D code) Stat Table Timeline

Feedback

Alert Empty state Notification Progress Pulse Ring progress Skeleton Spinner Step dots

Layout

App bar App shell Aspect ratio Card Center Container Grid Group Scroll area Separator Split Stack Status bar

Theme

Theme toggle
Components/Data display

Carousel

Slides in a scroll-snap viewport: native swipe and scrolling, previous/next controls, indicators, keyboard, loop and autoplay with a pause button.

Source on GitHub

1
2
3
4
A
B
C
D
E
Every
3 seconds
(hover pauses)
Code

Open the code

API

For AI agents: this API as Markdown, or every component in llms-full.txt.

<ray-carousel> · RayCarousel

Any child is a slide. With several slides in view, positions are the snap points the viewport can reach. ArrowLeft/Right (Up/Down when vertical), Home and End move it.

PropertyAttributeTypeDefaultDescription
indexindexnumber0Current position (0-based). Setting it scrolls there.
labellabelstringCarousel (text carousel.label)Accessible name of the carousel region.
slideSizeslide-sizestringSize of each slide along the scroll axis ("100%" by default; "50%", "18rem"…).
slideGapslide-gapstringSpace between slides (default var(--ray-space-4)).
alignalign reflectsstart | centerstartWhere a slide snaps in the viewport.
orientationorientation reflectshorizontal | verticalhorizontalScroll axis (vertical needs a height; 20rem by default).
looploop reflectsbooleannext() on the last position goes to the first, prev() on the first to the last.
autoplayautoplaynumber0Milliseconds between automatic moves (0: off). Pauses on hover, focus and when the page is hidden; starts paused with reduced motion. Shows a pause/play button.
hideControlshide-controls reflectsbooleanNo previous/next buttons.
hideIndicatorshide-indicators reflectsbooleanNo indicator dots.
EventDescription
changeThe current position changed (read `index`) by the user or a method (controls, indicators, keyboard, swipe, scroll, next/prev/goTo, autoplay) — not when `index` is set by code.
SlotDescription
(default)The slides.
PartDescription
viewportThe scrolling viewport.
previousThe previous button.
nextThe next button.
indicatorsThe row of indicator dots.
indicatorEach indicator dot ([aria-current] on the active one).
playThe pause/play button (with autoplay).

Texts

What it writes itself, in English; setStrings() translates them (Getting started: Languages).

KeyEnglish
carousel.labelCarousel
carousel.slideslide
carousel.position{index} of {count}
carousel.previousPrevious slide
carousel.nextNext slide
carousel.go-toGo to slide {index}
carousel.playStart autoplay
carousel.pausePause autoplay
PreviousBlockquoteNextCode
ray·elements — web components for any app, with raylang extras GitHub · npm · Changelog · License For AI agents: llms.txt · llms-full.txt Tokens, docs, tests and wrappers generated by tools/run.sh build