New collection
Linen shirts and summer dresses are in.
The examples below assume that you have imported the component and set up the theme.
Show a row of slides one page at a time, with previous and next buttons, page dots, and swipe. Each child of sv-carousel is one slide, and aria-label names the carousel.
The controls show --sv-carousel-slides-per-page, slides-per-move, align, loop, vertical, and button-placement.
<div class="carousel-basic"> <sv-carousel class="carousel" aria-label="Destinations"> <div class="slide" style="--hue: 20">Lisbon</div> <div class="slide" style="--hue: 80">Kyoto</div> <div class="slide" style="--hue: 140">Oslo</div> <div class="slide" style="--hue: 200">Cusco</div> <div class="slide" style="--hue: 260">Marrakesh</div> <div class="slide" style="--hue: 320">Hanoi</div> </sv-carousel></div>
<style> .carousel-basic { display: grid;
.carousel { block-size: 12rem; }
.carousel[vertical] { block-size: 16rem; }
.slide { display: grid; place-items: center; font-size: 1.25rem; font-weight: 600; color: white; background-image: linear-gradient( 135deg, oklch(65% 0.14 var(--hue)), oklch(45% 0.14 calc(var(--hue) + 40)) ); border-radius: var(--sv-bdr-rad-md); } }</style>Move to the next slide on a timer, with a button that stops it. autoplay moves to the next page every 5 seconds and shows the pause button.
The controls show paused, no-pause-on-hover, no-pause-button, and --sv-carousel-autoplay-dur.
Your system is set to reduce motion. Autoplay does not run for you.
Linen shirts and summer dresses are in.
On every order above 50 euros, until Sunday.
Send one by email in any amount.
<div class="carousel-autoplay"> <sv-carousel class="carousel" aria-label="Announcements" autoplay> <article class="slide"> <h3>New collection</h3> <p>Linen shirts and summer dresses are in.</p> </article> <article class="slide"> <h3>Free shipping</h3> <p>On every order above 50 euros, until Sunday.</p> </article> <article class="slide"> <h3>Gift cards</h3> <p>Send one by email in any amount.</p> </article> </sv-carousel></div>
<style> .carousel-autoplay { .slide { padding: 2em 4em; text-align: center; background-color: var(--sv-gray-6); border-radius: var(--sv-bdr-rad-md);
h3 { margin: 0; }
p { margin-block: 0.5em 0; color: var(--sv-gray-2); } } }</style>