Tabbed product shelf
Serif tabs switch between two rows of product cards on grey mats, each with name, line, price, round swatches and a sky-blue add-to-cart pill.
Part of the style
Peach Blob Starburst
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/peach-blob-starburst/shelf/figma.html?palette=bc3c15bc00a286f1
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/peach-blob-starburst/shelf/figma.html?palette=bc3c15bc00a286f1 and pass that whole HTML document to the html_to_figma tool, so the part "Tabbed product shelf" 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: #5e352b;
--ink-soft: #79574f;
--paper: #d5e8e6;
--paper-bright: #d9ecea;
--peach: #ddf1ef;
--mist: #d3e6e4;
--on-navy: #dbeeec;
--veil: rgba(94, 53, 43, 0.5);
--finish-chalk: #d8ebe9;
--navy: #7c6052;
--sky: #fff6f2;
--sage: #fee9db;
--tangerine: #c7a898;
--finish-honey: #bfaea6;
--finish-walnut: #a3958e;
}
</style>
<section class="shelf">
<div class="shelf__tabs" role="tablist" aria-label="Product lists">
<button class="shelf__tab is-active" type="button" role="tab" aria-selected="true" aria-controls="shelf-loved" id="shelf-tab-loved">Most loved</button>
<button class="shelf__tab" type="button" role="tab" aria-selected="false" aria-controls="shelf-new" id="shelf-tab-new">Just sprouted</button>
</div>
<ul class="shelf__row" id="shelf-loved" role="tabpanel" aria-labelledby="shelf-tab-loved">
<li class="shelf__card">
<a class="shelf__mat" href="#"><span class="shelf__badge">Bundle & grow</span><img class="shelf__picture" src="assets/apples.jpg" alt="A basket of apples tipped over a white cloth" width="800" height="639"></a>
<h3 class="shelf__name">The Picking Basket</h3>
<p class="shelf__line">Woven willow, sized for small arms</p>
<p class="shelf__price">From $48</p>
<div class="shelf__swatches" role="radiogroup" aria-label="Colour">
<button class="shelf__swatch is-picked" type="button" role="radio" aria-checked="true" aria-label="Honey" style="--swatch: var(--finish-honey)"></button>
<button class="shelf__swatch" type="button" role="radio" aria-checked="false" aria-label="Chalk" style="--swatch: var(--finish-chalk)"></button>
<button class="shelf__swatch" type="button" role="radio" aria-checked="false" aria-label="Walnut" style="--swatch: var(--finish-walnut)"></button>
</div>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/tools.jpg" alt="A pencil drawing of a basket with a spade and a pick" width="800" height="583"></a>
<h3 class="shelf__name">Little Digger Set</h3>
<p class="shelf__line">Spade, fork and a very serious rake</p>
<p class="shelf__price">$36</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/still-life.jpg" alt="A painted table with a basket of chestnuts, mushrooms and berries" width="800" height="659"></a>
<h3 class="shelf__name">Forager's Tray</h3>
<p class="shelf__line">Sort, count and keep the good ones</p>
<p class="shelf__price">$29</p>
<div class="shelf__swatches" role="radiogroup" aria-label="Colour">
<button class="shelf__swatch is-picked" type="button" role="radio" aria-checked="true" aria-label="Honey" style="--swatch: var(--finish-honey)"></button>
<button class="shelf__swatch" type="button" role="radio" aria-checked="false" aria-label="Walnut" style="--swatch: var(--finish-walnut)"></button>
</div>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><span class="shelf__badge">New</span><img class="shelf__picture" src="assets/woman-garden.jpg" alt="A painted figure in a straw bonnet among garden flowers" width="598" height="800"></a>
<h3 class="shelf__name">Sun Bonnet in Gingham</h3>
<p class="shelf__line">Wide brim, soft ties</p>
<p class="shelf__price">$22</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
</ul>
<ul class="shelf__row" id="shelf-new" role="tabpanel" aria-labelledby="shelf-tab-new" hidden>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/poets-garden.jpg" alt="A painted park with round trees and long grass" width="1000" height="788"></a>
<h3 class="shelf__name">Meadow Seed Tin</h3>
<p class="shelf__line">Twelve wildflowers, one shake</p>
<p class="shelf__price">$14</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/hero-garden.jpg" alt="A painted garden path with blue pots" width="1200" height="980"></a>
<h3 class="shelf__name">Glazed Pot Trio</h3>
<p class="shelf__line">Three sizes, one drainage hole each</p>
<p class="shelf__price">$54</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/garden-party.jpg" alt="An etching of children playing on a lawn" width="643" height="1000"></a>
<h3 class="shelf__name">Lawn Games Bag</h3>
<p class="shelf__line">Hoops, pegs and a bean bag</p>
<p class="shelf__price">$40</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
<li class="shelf__card">
<a class="shelf__mat" href="#"><img class="shelf__picture" src="assets/apples.jpg" alt="Apples in a basket" width="800" height="639"></a>
<h3 class="shelf__name">Orchard Crate</h3>
<p class="shelf__line">Stacks two high, rolls on rope</p>
<p class="shelf__price">$62</p>
<button class="shelf__add" type="button"><span class="shelf__plus" aria-hidden="true">+</span> Add to basket</button>
</li>
</ul>
</section>
<style>
.shelf {
padding: var(--space-xl) var(--edge) var(--section-space);
background: var(--paper);
}
.shelf__tabs {
display: flex;
gap: var(--space-m);
margin-bottom: var(--space-l);
}
.shelf__tab {
min-height: 44px;
padding: 0;
border: 0;
background: none;
color: var(--ink-soft);
font-family: var(--font-display);
font-variation-settings: var(--display-soft);
font-size: var(--display-s);
font-weight: var(--display-weight);
letter-spacing: 0;
cursor: pointer;
transition: color var(--time) var(--ease), opacity var(--time) var(--ease);
}
.shelf__tab:hover { opacity: 0.7; }
.shelf__tab.is-active {
color: var(--ink);
font-weight: 400;
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 8px;
}
.shelf__row {
display: grid;
grid-template-columns: repeat(4, minmax(0, 1fr));
gap: var(--space-l) var(--gap);
margin: 0;
padding: 0;
list-style: none;
}
.shelf__row[hidden] { display: none; }
.shelf.is-swapping .shelf__row { animation: shelf-in var(--time) var(--ease); }
@keyframes shelf-in { from { opacity: 0; } to { opacity: 1; } }
.shelf__card {
display: grid;
grid-template-rows: auto auto auto auto auto 1fr;
justify-items: center;
text-align: center;
}
.shelf__mat {
position: relative;
display: block;
width: 100%;
aspect-ratio: 1;
margin-bottom: var(--space-m);
overflow: hidden;
background: var(--mist);
}
.shelf__picture {
width: 100%;
height: 100%;
object-fit: cover;
transition: scale var(--slow) var(--ease);
}
.shelf__mat:hover .shelf__picture { scale: 1.04; }
.shelf__mat:focus-visible { outline: 2px solid var(--navy); outline-offset: 3px; }
.shelf__badge {
position: absolute;
top: 10px;
left: 10px;
z-index: 1;
padding: 3px 9px;
border-radius: var(--radius-pill);
background: var(--paper-bright);
font-size: 10px;
font-weight: 600;
letter-spacing: var(--tracking-caps);
text-transform: uppercase;
}
.shelf__name {
margin: 0;
font-size: var(--text-s);
font-weight: 500;
}
.shelf__line {
margin: 2px 0 0;
color: var(--ink-soft);
font-size: var(--text-xs);
}
.shelf__price {
margin: var(--space-s) 0 0;
font-size: var(--text-s);
}
.shelf__swatches {
display: flex;
margin: 2px 0 -6px;
}
.shelf__swatch {
display: grid;
place-items: center;
width: 44px;
height: 44px;
padding: 0;
border: 0;
background: none;
cursor: pointer;
}
.shelf__swatch::before {
content: "";
width: 14px;
height: 14px;
border: var(--line) solid rgba(10, 10, 10, 0.35);
border-radius: var(--radius-round);
background: var(--swatch);
box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px transparent;
transition: box-shadow var(--time) var(--ease);
}
.shelf__swatch.is-picked::before { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.shelf__add {
align-self: end;
display: inline-flex;
align-items: center;
gap: 6px;
min-height: 44px;
margin-top: var(--space-s);
padding: 0 22px;
border: 0;
border-radius: var(--radius-pill);
background: var(--sky);
color: var(--navy);
font: 500 var(--text-s)/1 var(--font-body);
letter-spacing: var(--tracking);
cursor: pointer;
transition: background-color var(--time) var(--ease), color var(--time) var(--ease);
}
.shelf__plus { font-size: 18px; line-height: 0; }
.shelf__add:hover { background: var(--navy); color: var(--on-navy); }
.shelf__add.is-added { background: var(--sage); color: var(--ink); }
.shelf button:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
@media (max-width: 900px) {
.shelf__row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 420px) {
.shelf__add { padding: 0 14px; font-size: var(--text-xs); }
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.shelf')) {
const tabs = [...root.querySelectorAll('.shelf__tab')];
tabs.forEach((tab) => tab.addEventListener('click', () => {
for (const other of tabs) {
const on = other === tab;
other.classList.toggle('is-active', on);
other.setAttribute('aria-selected', String(on));
root.querySelector('#' + other.getAttribute('aria-controls')).hidden = !on;
}
root.classList.remove('is-swapping');
void root.offsetWidth;
root.classList.add('is-swapping');
}));
for (const group of root.querySelectorAll('.shelf__swatches')) {
group.addEventListener('click', (event) => {
const pick = event.target.closest('.shelf__swatch');
if (!pick) return;
for (const swatch of group.querySelectorAll('.shelf__swatch')) {
swatch.classList.toggle('is-picked', swatch === pick);
swatch.setAttribute('aria-checked', String(swatch === pick));
}
});
}
for (const button of root.querySelectorAll('.shelf__add')) {
const label = button.innerHTML;
button.addEventListener('click', () => {
button.classList.add('is-added');
button.textContent = 'Added';
setTimeout(() => { button.classList.remove('is-added'); button.innerHTML = label; }, 1600);
});
}
}
})();
</script>