Carousel @astryx-svelte/core v0.3.0 · Carousel

Usage

Carousel scrolls a row of items horizontally when they overflow the available width. Use it for card grids, image galleries, product lists, or any set of items that should be browsable without taking up the full page.
ts
import { Carousel } from '@astryx-svelte/core';

Best practices

GuidancePractices
DoEnable scroll-snap when each item should land precisely at the start edge, like a gallery or product list.
DoReach for hasLoop on small, cyclable sets like a photo gallery, where wrapping past the last item back to the first feels natural.
DoAlways provide an aria-label that describes what the carousel contains, like "Featured products" or "Team members".
DoUse a consistent gap and item width so the carousel looks intentional, not like content overflowing by accident.
DoTrust the built-in navigation: trackpad users can swipe horizontally, and mouse users can hold Shift while scrolling the wheel to move through items.
Don'tUse a carousel for content every user must see. Not everyone scrolls horizontally, so put critical content above the fold.
Don'tAuto-advance items. Let the user scroll at their own pace.
Don'tNest carousels. A carousel inside a carousel is confusing and breaks keyboard navigation.

Examples

Common configurations, variations, and states.
Carousel — Cards
A horizontally scrollable row of cards with snap scrolling enabled. Use for feature grids, product lists, or any set of cards that overflows the available width. The carousel adds fade edges and navigation buttons automatically.
Carousel — Snap
Scroll-snap carousel with navigation buttons and team member cards. Each card snaps to the start edge on scroll. Use when items should be viewed one at a time rather than as a continuous strip.