City chips picture
One wide photograph with a row of white city pills over its lower edge; choosing a pill crossfades to that city's picture.
Part of the style
Kraft Panel Split
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/kraft-panel-split/cities/figma.html?palette=cfe1a8b0ee72a0a9
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/kraft-panel-split/cities/figma.html?palette=cfe1a8b0ee72a0a9 and pass that whole HTML document to the html_to_figma tool, so the part "City chips picture" 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: #000000;
--ink-soft: #825b5a;
--paper: #eeaaa8;
--paper-warm: #e7a5a3;
--field: #dd9d9c;
--stone: #be8785;
--kraft-deep: #1a1013;
--veil: rgba(0, 0, 0, 0.5);
--veil-soft: rgba(0, 0, 0, 0.2);
--paper-glass: rgba(238, 170, 168, 0.52);
--night: #eae8e9;
--night-ink: #050303;
--line: rgba(0, 0, 0, 0.08);
--kraft: #927271;
}
</style>
<section class="cities" aria-labelledby="cities-title">
<div class="cities__head">
<h2 class="cities__title" id="cities-title">Rooms by city</h2>
<a class="cities__more" href="#">All cities</a>
</div>
<div class="cities__frame">
<img class="cities__img is-current" src="assets/sunlit-parlour.jpg" alt="Sunlight on the wall of a pale parlour" width="1200" height="986">
<img class="cities__img" src="assets/sitting-room.jpg" alt="A sitting room with red curtains and two windows" width="800" height="559">
<img class="cities__img" src="assets/drawing-room.jpg" alt="A drawing room with columns and a bookcase" width="800" height="615">
<img class="cities__img" src="assets/dining-room.jpg" alt="A panelled dining room with a long table" width="800" height="547">
<div class="cities__chips" role="tablist" aria-label="Cities">
<button class="cities__chip is-active" type="button" role="tab" aria-selected="true">Ghent</button>
<button class="cities__chip" type="button" role="tab" aria-selected="false">Turin</button>
<button class="cities__chip" type="button" role="tab" aria-selected="false">Kraków</button>
<button class="cities__chip" type="button" role="tab" aria-selected="false">Bergen</button>
</div>
</div>
</section>
<style>
.cities {
padding: var(--section-space) var(--edge);
}
.cities__head {
display: flex;
align-items: center;
justify-content: space-between;
gap: var(--space-m);
margin-bottom: var(--space-l);
}
.cities__title {
margin: 0;
font-family: var(--font-serif);
font-size: var(--text-l);
font-weight: 400;
}
.cities__more {
display: inline-flex;
align-items: center;
min-height: 44px;
padding: 0 14px;
border-radius: var(--pill);
background: var(--field);
color: var(--ink);
font-size: var(--text-s);
font-weight: 500;
text-decoration: none;
transition: background var(--quick) var(--ease);
}
.cities__more:hover { background: var(--stone); }
.cities__frame {
position: relative;
display: grid;
aspect-ratio: 2 / 1;
overflow: hidden;
border-radius: var(--radius-s);
background: var(--paper-warm);
}
.cities__img {
grid-area: 1 / 1;
width: 100%;
height: 100%;
object-fit: cover;
opacity: 0;
transition: opacity var(--fade) var(--ease);
}
.cities__img.is-current { opacity: 1; }
.cities__frame::after {
content: "";
grid-area: 1 / 1;
background: linear-gradient(to top, var(--veil-soft), transparent 45%);
pointer-events: none;
}
.cities__chips {
position: absolute;
z-index: 1;
left: var(--space-m);
right: var(--space-m);
bottom: var(--space-m);
display: flex;
flex-wrap: wrap;
gap: var(--space-xs);
}
.cities__chip {
min-height: 44px;
padding: 0 18px;
border: 0;
border-radius: var(--pill);
background: var(--paper);
color: var(--ink);
font: 500 var(--text-s) var(--font-body);
cursor: pointer;
transition: background var(--quick) var(--ease), color var(--quick) var(--ease), transform 180ms var(--spring);
}
.cities__chip:hover { background: var(--field); }
.cities__chip:active { transform: scale(0.94); }
.cities__chip.is-active { background: var(--ink); color: var(--paper); }
.cities a:focus-visible,
.cities__chip:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
@media (max-width: 40rem) {
.cities__frame { aspect-ratio: 4 / 5; }
}
</style>
<script>
(() => {
for (const root of document.querySelectorAll('.cities')) {
const chips = [...root.querySelectorAll('.cities__chip')];
const pictures = [...root.querySelectorAll('.cities__img')];
chips.forEach((chip, index) => chip.addEventListener('click', () => {
chips.forEach((other, i) => {
other.classList.toggle('is-active', i === index);
other.setAttribute('aria-selected', String(i === index));
});
pictures.forEach((picture, i) => picture.classList.toggle('is-current', i === index % pictures.length));
}));
}
})();
</script>