Framed slideshow
One big framed picture with round white arrows, a counter and caption; it cross-fades to the next and answers the arrow keys.
Part of the style
Pastel Wave Snapshots
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/pastel-wave-snapshots/slideshow/figma.html?palette=bbcf0e6ddd5984d4
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/pastel-wave-snapshots/slideshow/figma.html?palette=bbcf0e6ddd5984d4 and pass that whole HTML document to the html_to_figma tool, so the part "Framed slideshow" lands as editable layers in my open Figma file. Fonts come from Google Fonts: if a face is missing in Figma, pick the closest one.
Code
<style>
/* Goes after the pack's base.css */
:root {
--ink: #020006;
--ink-soft: #301347;
--frame: #f8f0fe;
--paper: #ebd5fe;
--dot: rgba(91, 65, 115, 0.349);
--scrim: rgba(2, 0, 6, 0.851);
--shadow-ink: rgba(2, 0, 6, 0.149);
--link: #6c338f;
--link-deep: #521772;
--ribbon-blue: #4b1d6d;
--ribbon-teal: #986db5;
--ribbon-cream: #a86fd0;
--ribbon-pink: #9063b8;
}
</style>
<section class="slideshow" aria-roledescription="carousel" aria-label="Picture of the week">
<div class="slideshow__frame" tabindex="0">
<figure class="slideshow__slide is-active">
<img class="slideshow__photo" src="assets/mother-seashore.jpg" alt="Two figures wrapped in shawls on a grey beach, watching the waves" width="800" height="521">
<figcaption class="slideshow__caption"><b class="slideshow__q">who are these people?</b> no idea. they brought a basket.</figcaption>
</figure>
<figure class="slideshow__slide">
<img class="slideshow__photo" src="assets/gulf-salerno.jpg" alt="Golden cliffs over a calm gulf with one small boat" width="800" height="562" loading="lazy">
<figcaption class="slideshow__caption"><b class="slideshow__q">where is the person?</b> in the boat. squint.</figcaption>
</figure>
<figure class="slideshow__slide">
<img class="slideshow__photo" src="assets/boats-etretat.jpg" alt="Fishing boats and thatched sheds on a stony beach under cliffs" width="800" height="638" loading="lazy">
<figcaption class="slideshow__caption"><b class="slideshow__q">does a boat count?</b> this one was staring. it counts.</figcaption>
</figure>
<figure class="slideshow__slide">
<img class="slideshow__photo" src="assets/york-harbor.jpg" alt="A misty harbour at low sun with two sailing boats" width="800" height="400" loading="lazy">
<figcaption class="slideshow__caption"><b class="slideshow__q">why so misty?</b> they were looking very hard.</figcaption>
</figure>
<span class="slideshow__spinner" aria-hidden="true"></span>
</div>
<div class="slideshow__bar">
<button class="slideshow__arrow" type="button" data-step="-1" aria-label="Previous picture">←</button>
<p class="slideshow__count" aria-live="polite"><span class="slideshow__now">1</span> / <span class="slideshow__all">4</span></p>
<button class="slideshow__arrow" type="button" data-step="1" aria-label="Next picture">→</button>
</div>
</section>
<style>
.slideshow {
max-width: calc(var(--column) + 2 * var(--edge));
margin: 0 auto;
padding: var(--section-space) var(--edge);
}
.slideshow__frame {
position: relative;
display: grid;
padding: var(--frame-pad);
border-radius: var(--radius-frame);
background: var(--frame);
box-shadow: var(--shadow);
}
.slideshow__frame:focus-visible { outline: 3px solid var(--link); outline-offset: 3px; }
.slideshow__slide {
grid-area: 1 / 1;
margin: 0;
opacity: 0;
visibility: hidden;
transition: opacity var(--slow) var(--ease), visibility var(--slow) var(--ease);
}
.slideshow__slide.is-active { opacity: 1; visibility: visible; }
.slideshow__photo {
width: 100%;
height: auto;
aspect-ratio: 3 / 2;
object-fit: cover;
border-radius: var(--radius-photo);
background: var(--paper);
}
.slideshow__caption {
padding: var(--space-s) var(--space-xs) var(--space-xs);
font-size: var(--text-s);
text-align: center;
}
.slideshow__q {
display: block;
color: var(--ink-soft);
font-style: italic;
font-weight: 700;
}
.slideshow__spinner {
position: absolute;
top: 42%;
left: 50%;
width: 36px;
height: 36px;
margin: -18px 0 0 -18px;
border: 3px solid var(--frame);
border-right-color: transparent;
border-radius: var(--radius-pill);
opacity: 0;
transition: opacity var(--quick) var(--ease);
}
.slideshow.is-waiting .slideshow__spinner {
opacity: 1;
animation: slideshow-spin var(--spin) linear infinite;
}
.slideshow__bar {
display: flex;
align-items: center;
justify-content: center;
gap: var(--space-l);
margin-top: var(--space-l);
}
.slideshow__arrow {
width: 48px;
height: 48px;
border: 0;
border-radius: var(--radius-pill);
background: var(--frame);
box-shadow: var(--shadow);
color: var(--ink);
font: 800 var(--text-m) / 1 var(--font-body);
cursor: pointer;
transition: transform var(--quick) var(--ease), color var(--quick) var(--ease);
}
.slideshow__arrow:hover { transform: scale(1.08); color: var(--link); }
.slideshow__arrow:focus-visible { outline: 3px solid var(--link); outline-offset: 2px; }
.slideshow__count {
margin: 0;
min-width: 4em;
color: var(--ink);
font-size: var(--text-m);
font-weight: 800;
letter-spacing: -0.03em;
text-align: center;
}
@keyframes slideshow-spin { to { transform: rotate(1turn); } }
@media (prefers-reduced-motion: reduce) {
.slideshow__slide { transition: none; }
.slideshow__arrow:hover { transform: none; }
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.slideshow')) {
const slides = [...root.querySelectorAll('.slideshow__slide')];
const now = root.querySelector('.slideshow__now');
root.querySelector('.slideshow__all').textContent = slides.length;
let current = 0;
const go = (index) => {
const next = (index + slides.length) % slides.length;
const img = slides[next].querySelector('img');
const swap = () => {
root.classList.remove('is-waiting');
slides[current].classList.remove('is-active');
slides[next].classList.add('is-active');
current = next;
now.textContent = current + 1;
};
if (img.complete && img.naturalWidth) return swap();
root.classList.add('is-waiting');
img.loading = 'eager';
img.addEventListener('load', swap, { once: true });
};
root.querySelectorAll('.slideshow__arrow').forEach((button) =>
button.addEventListener('click', () => go(current + Number(button.dataset.step))));
root.querySelector('.slideshow__frame').addEventListener('keydown', (event) => {
if (event.key === 'ArrowRight') go(current + 1);
if (event.key === 'ArrowLeft') go(current - 1);
});
}
})();
</script>