Loose project grid
Grey-pill filter tabs over a twelve-column grid of pictures of different sizes with two-line didone captions; tabs fade out the tiles that do not match.
Part of the style
Yellow Curtain Didone
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/yellow-curtain-didone/gallery/figma.html
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/yellow-curtain-didone/gallery/figma.html and pass that whole HTML document to the html_to_figma tool, so the part "Loose project grid" 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
<section class="gallery" aria-label="Selected work">
<div class="gallery__tabs" role="toolbar" aria-label="Filter work">
<button class="gallery__tab is-active" type="button" data-filter="all" aria-pressed="true">Featured</button>
<button class="gallery__tab" type="button" data-filter="identity" aria-pressed="false">Identity</button>
<button class="gallery__tab" type="button" data-filter="campaign" aria-pressed="false">Campaign</button>
<button class="gallery__tab" type="button" data-filter="film" aria-pressed="false">Film</button>
</div>
<ul class="gallery__grid">
<li class="gallery__tile" data-tags="identity" style="--at: 1; --span: 4; --shape: 4 / 5">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/dancers.jpg" alt="Dancers in pale skirts crossing a green stage" width="1189" height="1200" loading="lazy">
<span class="gallery__client">Velde Dance Company</span>
<span class="gallery__job">Season Identity</span>
</a>
</li>
<li class="gallery__tile" data-tags="campaign" style="--at: 6; --span: 7; --shape: 7 / 5">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/fruit.jpg" alt="Grapes, strawberries, lemon and a glass of wine on a stone ledge" width="1200" height="993" loading="lazy">
<span class="gallery__client">Ferro Table</span>
<span class="gallery__job">Harvest Campaign</span>
</a>
</li>
<li class="gallery__tile" data-tags="identity film" style="--at: 10; --span: 3; --shape: 4 / 5">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/portrait-hat.jpg" alt="A painted portrait of a woman in a wide blue hat" width="1013" height="1200" loading="lazy">
<span class="gallery__client">Marrow Records</span>
<span class="gallery__job">Rebrand</span>
</a>
</li>
<li class="gallery__tile" data-tags="campaign" style="--at: 1; --span: 5; --shape: 1 / 1">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/milliner.jpg" alt="A milliner fitting a hat among others on stands" width="1200" height="1090" loading="lazy">
<span class="gallery__client">Plume Millinery</span>
<span class="gallery__job">Shop & Identity</span>
</a>
</li>
<li class="gallery__tile" data-tags="film" style="--at: 7; --span: 2; --shape: 3 / 4">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/pleiade.jpg" alt="A white marble figure shading her eyes on a cloud" width="950" height="1200" loading="lazy">
<span class="gallery__client">Casterwell Gallery</span>
<span class="gallery__job">Opening Titles</span>
</a>
</li>
<li class="gallery__tile" data-tags="film identity" style="--at: 4; --span: 6; --shape: 3 / 2">
<a class="gallery__link" href="#">
<img class="gallery__img" src="assets/apples.jpg" alt="A basket of apples, a bottle and a cloth on a table" width="1200" height="958" loading="lazy">
<span class="gallery__client">Orrin Larder</span>
<span class="gallery__job">Brand Film</span>
</a>
</li>
</ul>
</section>
<style>
.gallery {
padding: var(--space-m) var(--edge) var(--section-space);
background: var(--paper);
color: var(--ink);
}
.gallery__tabs {
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
margin-bottom: var(--space-s);
}
.gallery__tab {
min-height: var(--tap);
min-width: var(--tap);
padding: 0 var(--space-m);
border: 0;
border-radius: var(--radius);
background: transparent;
color: var(--ink-soft);
font: 500 var(--text-s) var(--font-body);
cursor: pointer;
transition: color var(--grid-time) var(--ease), background-color var(--grid-time) var(--ease);
}
.gallery__tab:hover {
color: var(--ink);
}
.gallery__tab.is-active {
background: var(--chip);
color: var(--ink);
}
.gallery__tab:focus-visible,
.gallery__link:focus-visible {
outline: var(--rule) solid var(--ink);
outline-offset: 2px;
}
.gallery__grid {
display: grid;
grid-template-columns: repeat(12, minmax(0, 1fr));
grid-auto-flow: row dense;
align-items: start;
column-gap: var(--gap);
row-gap: var(--space-l);
margin: 0;
padding: 0;
list-style: none;
}
.gallery__tile {
grid-column: var(--at) / span var(--span);
transition: opacity var(--quick) var(--ease);
}
.gallery__tile.is-fading {
opacity: 0;
}
.gallery__tile.is-out {
display: none;
}
.gallery.is-filtered .gallery__tile {
grid-column: auto / span 4;
}
.gallery__link {
display: block;
color: inherit;
text-decoration: none;
}
.gallery__img {
width: 100%;
height: auto;
aspect-ratio: var(--shape);
object-fit: cover;
margin-bottom: var(--space-s);
transform: scale(1);
transition: transform var(--slow) var(--ease-soft);
}
.gallery__link {
overflow: hidden;
}
.gallery__link:hover .gallery__img {
transform: scale(1.03);
}
.gallery__client,
.gallery__job {
display: block;
font-family: var(--font-display);
font-size: var(--display-m);
letter-spacing: var(--display-track);
line-height: 1;
transition: color var(--quick) var(--ease);
}
.gallery__client {
text-transform: uppercase;
}
.gallery__job {
font-style: italic;
}
.gallery__link:hover .gallery__client,
.gallery__link:hover .gallery__job {
color: var(--ink-soft);
}
@media (max-width: 56rem) {
.gallery__grid,
.gallery.is-filtered .gallery__grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.gallery__tile,
.gallery.is-filtered .gallery__tile {
grid-column: auto / span 1;
}
.gallery__tile:nth-child(3n + 2) {
grid-column: 1 / -1;
}
}
@media (max-width: 30rem) {
.gallery__tile,
.gallery.is-filtered .gallery__tile {
grid-column: 1 / -1;
}
.gallery__tab {
padding: 0 var(--space-s);
}
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.gallery')) {
const tabs = [...root.querySelectorAll('.gallery__tab')];
const tiles = [...root.querySelectorAll('.gallery__tile')];
let timer;
const apply = (filter) => {
tabs.forEach((tab) => {
const on = tab.dataset.filter === filter;
tab.classList.toggle('is-active', on);
tab.setAttribute('aria-pressed', String(on));
});
tiles.forEach((tile) => tile.classList.add('is-fading'));
clearTimeout(timer);
timer = setTimeout(() => {
root.classList.toggle('is-filtered', filter !== 'all');
tiles.forEach((tile) => {
const keep = filter === 'all' || tile.dataset.tags.split(' ').includes(filter);
tile.classList.toggle('is-out', !keep);
});
requestAnimationFrame(() => tiles.forEach((tile) => tile.classList.remove('is-fading')));
}, 200);
};
tabs.forEach((tab) => tab.addEventListener('click', () => apply(tab.dataset.filter)));
}
})();
</script>