Components / Surfaces
Carousel
A scroll-snap carousel with controls and indicators.
<section class="carousel" data-orientation="horizontal" aria-roledescription="carousel" aria-label="Featured components">
<div class="carousel-viewport" tabindex="0">
<div class="carousel-track">
<div class="carousel-item" role="group" aria-roledescription="slide" aria-label="1 of 3">
<div class="card">
<header>
<h3 data-slot="title">Accordion</h3>
<p data-slot="description">Disclosure patterns</p>
</header>
<section>
<p>Native details and summary with exclusive groups.</p>
</section>
</div>
</div>
<div class="carousel-item" role="group" aria-roledescription="slide" aria-label="2 of 3">
<div class="card">
<header>
<h3 data-slot="title">Avatar</h3>
<p data-slot="description">Identity at a glance</p>
</header>
<section>
<p>Images, fallback initials, badges and overlapping groups.</p>
</section>
</div>
</div>
<div class="carousel-item" role="group" aria-roledescription="slide" aria-label="3 of 3">
<div class="card">
<header>
<h3 data-slot="title">Breadcrumb</h3>
<p data-slot="description">Navigation context</p>
</header>
<section>
<p>Ordered links with a current page and collapsed paths.</p>
</section>
</div>
</div>
</div>
</div>
<div class="carousel-controls">
<button type="button" class="carousel-button" aria-label="Previous slide"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m15 18-6-6 6-6"/></svg></button>
<div class="carousel-indicators" role="group" aria-label="Slides">
<button type="button" class="carousel-indicator" aria-label="Go to slide 1" aria-current="true"></button>
<button type="button" class="carousel-indicator" aria-label="Go to slide 2"></button>
<button type="button" class="carousel-indicator" aria-label="Go to slide 3"></button>
</div>
<button type="button" class="carousel-button" aria-label="Next slide"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="m9 18 6-6-6-6"/></svg></button>
</div>
</section>Installation
pnpm dlx loseta add carouselnpx loseta add carouselAccessibility and behavior
- A scroll-snap viewport and track. Items use scroll-snap-align. Consumers own scrolling, aria-current on indicators, aria-hidden/inert on offscreen slides and any autoplay.
Files
components/carousel.cssbasestyles/nova/carousel.cssstyleInstall contract
The CLI writes the base file under components/, the visual file for the selected style under styles/<name>/, and any primitive dependency underprimitives/. The generated index.css imports them in the right layer order.