Shop shelf
A label row and four small product tiles: a white picture square with a drawn item and a framed caption box with name and price. Tiles rise on hover and show a round add button that confirms with a tick.
Part of the style
Night Chart Console
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/night-chart-console/shelf/figma.html?palette=c6954d0e159de5cf
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/night-chart-console/shelf/figma.html?palette=c6954d0e159de5cf and pass that whole HTML document to the html_to_figma tool, so the part "Shop 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 {
--night: #ffffff;
--paper: #3b3c37;
--paper-dim: rgba(59, 60, 55, 0.6);
--paper-faint: rgba(59, 60, 55, 0.36);
--night-dim: rgba(255, 255, 255, 0.6);
--night-faint: rgba(255, 255, 255, 0.4);
--smoke: #bcbbb9;
--fog: #41423d;
--wordmark-shade: #545551;
--map-ghost: #737470;
--retro-face: #5d5d59;
--retro-chip: #43443f;
--retro-edge: #8f8f8c;
--scene-sky: #b1a889;
--scene-sea: #afaa98;
--retro-bar: #b9a86d;
--retro-bar-end: #eadcad;
--map-line: #f5eac5;
--scene-glow: #7792a3;
--map-live: #5f7481;
--scene-lamp: #357ca1;
--scene-amber: #7e6d16;
}
</style>
<section class="shelf">
<header class="shelf__head">
<h2 class="shelf__label">Ship's stores</h2>
<a class="shelf__all" href="#">All 14 items</a>
</header>
<ul class="shelf__grid">
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<path class="shelf__strap" d="M74 84V60a26 26 0 0 1 52 0v24" />
<path class="shelf__cloth" d="M46 78h108l8 98H38z" />
<text class="shelf__print" x="100" y="136" text-anchor="middle">Small Hours</text>
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Night Shift Tote</span>
<span class="shelf__price">$28</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Night Shift Tote in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<path class="shelf__cloth" d="M62 126C62 80 88 58 114 58c30 0 50 24 50 60v8z" />
<path class="shelf__cloth" d="M64 120c-24 2-42 10-48 24 36-10 72-12 106-12l42-8z" />
<circle class="shelf__cloth" cx="114" cy="57" r="4.5" />
<path class="shelf__arc" d="M90 108a17 17 0 0 1 34 0M98 108a9 9 0 0 1 18 0" />
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Dead Air Cap</span>
<span class="shelf__price">$34</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Dead Air Cap in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<rect class="shelf__cloth" x="28" y="54" width="144" height="94" rx="8" />
<rect class="shelf__pale" x="42" y="66" width="116" height="52" rx="3" />
<rect class="shelf__cloth" x="60" y="88" width="80" height="22" rx="11" />
<circle class="shelf__hole" cx="74" cy="99" r="6.5" />
<circle class="shelf__hole" cx="126" cy="99" r="6.5" />
<path class="shelf__seam" d="M58 148l8-20h68l8 20" />
<text class="shelf__ink" x="100" y="82" text-anchor="middle">Fog Set</text>
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Tape 014: Fog Set</span>
<span class="shelf__price">$12</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Tape 014: Fog Set in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<path class="shelf__strap" d="M136 84c30 0 30 46 0 46" />
<rect class="shelf__cloth" x="54" y="60" width="88" height="94" rx="9" />
<text class="shelf__print shelf__print--small" x="98" y="113" text-anchor="middle">Small Hours</text>
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Kettle Watch Mug</span>
<span class="shelf__price">$18</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Kettle Watch Mug in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<path class="shelf__cloth" d="M74 42c8 11 44 11 52 0l46 24-15 32-15-8v84H58V90l-15 8-15-32z" />
<text class="shelf__print shelf__print--small" x="100" y="112" text-anchor="middle">Small Hours</text>
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Crew Tee, Black</span>
<span class="shelf__price">$32</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Crew Tee, Black in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
<li class="shelf__item">
<a class="shelf__tile" href="#">
<span class="shelf__picture">
<svg class="shelf__art" viewBox="0 0 200 200" aria-hidden="true" focusable="false">
<circle class="shelf__cloth" cx="100" cy="100" r="64" />
<circle class="shelf__stitch" cx="100" cy="100" r="56" />
<path class="shelf__arc" d="M70 112a30 30 0 0 1 60 0M81 112a19 19 0 0 1 38 0M91 112a9 9 0 0 1 18 0" />
<text class="shelf__print shelf__print--small" x="100" y="138" text-anchor="middle">87.9</text>
</svg>
</span>
<span class="shelf__caption">
<span class="shelf__name">Relay Patch</span>
<span class="shelf__price">$6</span>
</span>
</a>
<button class="shelf__add" type="button" aria-pressed="false" aria-label="Relay Patch in bag">
<svg class="shelf__add-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false">
<path class="shelf__add-plus" d="M12 6v12M6 12h12" />
<path class="shelf__add-tick" d="M6 12.5l4 4 8-9" />
</svg>
</button>
</li>
</ul>
</section>
<style>
.shelf {
padding: var(--section-space) var(--gutter);
background: var(--night);
color: var(--paper);
}
.shelf__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-s);
margin-bottom: var(--space-s);
}
.shelf__label {
margin: 0;
font-size: inherit;
font-weight: 400;
text-transform: uppercase;
}
.shelf__all {
display: inline-flex;
align-items: center;
min-height: var(--tap);
color: inherit;
text-decoration: underline var(--frame) currentColor;
text-transform: uppercase;
text-underline-offset: 0.4em;
transition: text-decoration-color var(--time-fast) var(--ease-fast);
}
.shelf__all:hover,
.shelf__all:focus-visible {
text-decoration-color: transparent;
}
.shelf__grid {
display: grid;
grid-template-columns: repeat(6, minmax(0, 1fr));
gap: var(--gap);
margin: 0;
padding: 0;
list-style: none;
}
.shelf__item {
position: relative;
display: grid;
transition: translate var(--time) ease-out;
}
.shelf__item:hover,
.shelf__item:focus-within {
translate: 0 calc(-1 * var(--lift));
}
.shelf__tile {
display: grid;
grid-template-rows: auto 1fr;
color: inherit;
text-decoration: none;
}
.shelf__picture {
display: block;
aspect-ratio: 1;
background: var(--paper);
}
.shelf__art {
display: block;
width: 100%;
height: 100%;
}
.shelf__cloth {
fill: var(--night);
}
.shelf__pale {
fill: var(--wordmark-shade);
}
.shelf__hole {
fill: var(--paper);
}
.shelf__strap,
.shelf__seam,
.shelf__arc,
.shelf__stitch {
fill: none;
stroke: var(--night);
stroke-linecap: round;
stroke-width: 9;
}
.shelf__seam {
stroke: var(--smoke);
stroke-width: 2;
}
.shelf__arc {
stroke: var(--wordmark-shade);
stroke-width: 3.5;
}
.shelf__stitch {
stroke: var(--wordmark-shade);
stroke-dasharray: 5 4;
stroke-linecap: butt;
stroke-width: 1.5;
}
.shelf__print,
.shelf__ink {
fill: var(--wordmark-shade);
font: italic 700 19px var(--font-script);
}
.shelf__print--small {
font-size: 15px;
}
.shelf__ink {
fill: var(--night);
font-size: 13px;
}
.shelf__caption {
display: grid;
align-content: center;
gap: 0.125rem;
padding: 0.8125rem var(--space-xs);
border: var(--frame) solid var(--paper);
text-align: center;
}
.shelf__price {
color: var(--paper-dim);
}
/* The add button waits for a hover where there is one, and stays on screen where there is none. */
.shelf__add {
position: absolute;
top: 0.375rem;
right: 0.375rem;
display: grid;
place-items: center;
width: 2.25rem;
height: 2.25rem;
padding: 0;
border: var(--frame) solid var(--night);
border-radius: var(--radius-pill);
background: var(--paper);
color: var(--night);
cursor: pointer;
transition: opacity var(--time) ease, background-color var(--time-slow) ease, color var(--time-slow) ease;
}
.shelf__add:hover,
.shelf__add.is-added {
background: var(--night);
color: var(--paper);
}
.shelf__add::before {
content: "";
position: absolute;
top: 50%;
left: 50%;
width: var(--tap);
height: var(--tap);
translate: -50% -50%;
}
.shelf__add-icon {
width: 1.25rem;
height: 1.25rem;
fill: none;
stroke: currentColor;
stroke-width: 1.5;
}
.shelf__add-tick,
.shelf__add.is-added .shelf__add-plus {
display: none;
}
.shelf__add.is-added .shelf__add-tick {
display: inline;
}
@media (hover: hover) {
.shelf__add {
opacity: 0;
}
.shelf__item:hover .shelf__add,
.shelf__add:focus-visible,
.shelf__add.is-added {
opacity: 1;
}
}
.shelf :focus-visible {
outline: var(--frame) solid var(--paper);
outline-offset: 3px;
}
.shelf__add:focus-visible {
outline-color: var(--night);
outline-offset: -4px;
}
@media (max-width: 52rem) {
.shelf__grid {
grid-template-columns: repeat(3, minmax(0, 1fr));
}
}
@media (max-width: 30rem) {
.shelf__grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (prefers-reduced-motion: reduce) {
.shelf__item,
.shelf__add,
.shelf__all {
transition-duration: 0s;
}
.shelf__item:hover,
.shelf__item:focus-within {
translate: 0 0;
}
}
</style>
<script>
(() => {
const ADDED = "is-added";
const setUpAdd = (button) => {
button.addEventListener("click", () => {
const added = button.classList.toggle(ADDED);
button.setAttribute("aria-pressed", String(added));
});
};
document.querySelectorAll(".shelf").forEach((root) => root.querySelectorAll(".shelf__add").forEach(setUpAdd));
})();
</script>