Corner masthead
Name, three-line menu with the current page in a drawn oval, a bracketed language switch that swaps the statement between English and Dutch, and a statement column from the middle of the page. On phones the statement is large with a plus that opens a full-screen menu.
Part of the style
Sticker Badge Studio
6 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/sticker-badge-studio/masthead/figma.html?type=selection-frame-lab
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/sticker-badge-studio/masthead/figma.html?type=selection-frame-lab and pass that whole HTML document to the html_to_figma tool, so the part "Corner masthead" 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 */
@import url("https://fonts.googleapis.com/css2?family=Geist:wght@400;500&display=swap");
:root {
--font-text: "Geist", "Helvetica Neue", Arial, sans-serif;
}
</style>
<header class="masthead">
<div class="masthead__group">
<a class="masthead__name" href="#">blip</a>
<nav class="masthead__menu" aria-label="main">
<a class="masthead__link is-current" href="#" aria-current="page">work<svg class="masthead__ring" viewBox="0 0 100 40" preserveAspectRatio="none" aria-hidden="true"><ellipse cx="50" cy="20" rx="48" ry="18" /></svg></a>
<a class="masthead__link" href="#">about</a>
<a class="masthead__link" href="#">hello</a>
</nav>
<button class="masthead__lang" type="button" aria-label="language: english. switch to dutch">(en)</button>
</div>
<p class="masthead__statement"
data-en="blip is a computational design studio for tools, type and odd little machines. three desks in ghent, one pen plotter. we draw it, code it and stay until it works."
data-nl="blip is een computationele ontwerpstudio voor gereedschap, letters en rare kleine machines. drie bureaus in gent, één penplotter. we tekenen het, coderen het en blijven tot het werkt.">blip is a computational design studio for tools, type and odd little machines. three desks in ghent, one pen plotter. we draw it, code it and stay until it works.</p>
<button class="masthead__toggle" type="button" aria-expanded="false" aria-label="open menu"><span class="masthead__plus" aria-hidden="true"></span></button>
</header>
<style>
.masthead {
position: relative;
display: grid;
grid-template-columns: 10fr 10fr 30fr 50fr;
align-items: start;
padding: var(--edge);
font-size: var(--text-m);
line-height: var(--leading);
}
.masthead__group {
display: contents;
}
.masthead__name,
.masthead__link,
.masthead__lang {
display: flex;
align-items: center;
width: max-content;
min-width: var(--tap);
min-height: var(--tap);
margin-block: calc((1lh - var(--tap)) / 2);
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
text-decoration: none;
cursor: pointer;
transition: color var(--time) var(--ease);
}
.masthead__name:hover,
.masthead__link:hover,
.masthead__lang:hover {
color: var(--signal-red);
}
.masthead__name:focus-visible,
.masthead__link:focus-visible,
.masthead__lang:focus-visible,
.masthead__toggle:focus-visible {
outline: 2px solid var(--signal-blue);
outline-offset: 2px;
}
.masthead__menu {
display: grid;
justify-items: start;
}
.masthead__link {
position: relative;
}
.masthead__ring {
position: absolute;
top: 50%;
left: -0.16em;
width: calc(100% + 0.32em);
height: 1.12em;
translate: 0 -50%;
overflow: visible;
pointer-events: none;
}
.masthead__ring ellipse {
fill: none;
stroke: currentColor;
stroke-width: 0.075em;
vector-effect: non-scaling-stroke;
}
.masthead__statement {
margin: 0;
max-width: 44ch;
text-wrap: pretty;
transition: opacity var(--time) var(--ease), filter var(--time) var(--ease);
}
.masthead__statement.is-swapping {
opacity: 0;
filter: blur(4px);
}
.masthead__toggle {
display: none;
}
/* Phones: the statement leads, the menu waits behind a plus. */
@media (max-width: 40rem) {
.masthead {
grid-template-columns: 1fr var(--tap);
gap: var(--gap);
font-size: var(--text-l);
}
.masthead__statement {
grid-column: 1;
grid-row: 1;
}
.masthead__toggle {
position: relative;
z-index: 3;
display: grid;
place-items: center;
grid-column: 2;
grid-row: 1;
width: var(--tap);
height: var(--tap);
margin: calc(-0.5 * (var(--tap) - 1lh)) calc(-0.5 * var(--edge)) 0 0;
padding: 0;
border: 0;
background: none;
color: inherit;
cursor: pointer;
}
.masthead__plus,
.masthead__plus::before {
display: block;
width: 1.1rem;
height: 0.2rem;
background: currentColor;
transition: rotate var(--time) var(--ease-pop);
}
.masthead__plus::before {
content: "";
rotate: 90deg;
}
.masthead.is-open .masthead__plus {
rotate: 45deg;
}
.masthead__group {
position: fixed;
inset: 0;
z-index: 2;
display: grid;
grid-template-columns: auto 1fr;
grid-template-rows: auto 1fr;
column-gap: var(--space-m);
padding: var(--edge) var(--edge) calc(var(--edge) * 2);
background: var(--veil);
backdrop-filter: blur(6px);
font-size: var(--text-l);
opacity: 0;
visibility: hidden;
transition: opacity var(--time) var(--ease), visibility 0s linear var(--time);
}
.masthead.is-open .masthead__group {
opacity: 1;
visibility: visible;
transition: opacity var(--time) var(--ease), visibility 0s;
}
.masthead__lang {
grid-row: 1;
grid-column: 2;
}
.masthead__menu {
grid-column: 1 / -1;
grid-row: 2;
align-content: space-between;
padding-left: 0.2em;
padding-top: var(--space-l);
font-size: var(--text-xl);
}
}
</style>
<script>
(() => {
const PHONE = window.matchMedia('(max-width: 40rem)');
function setUpLanguage(root) {
const button = root.querySelector('.masthead__lang');
const statement = root.querySelector('.masthead__statement');
const names = { en: 'english', nl: 'dutch' };
let language = 'en';
button.addEventListener('click', () => {
const next = language === 'en' ? 'nl' : 'en';
statement.classList.add('is-swapping');
setTimeout(() => {
statement.textContent = statement.dataset[next];
statement.lang = next;
statement.classList.remove('is-swapping');
}, 300);
button.textContent = `(${next})`;
button.setAttribute('aria-label', `language: ${names[next]}. switch to ${names[language]}`);
language = next;
});
}
function setUpMenu(root) {
const toggle = root.querySelector('.masthead__toggle');
const group = root.querySelector('.masthead__group');
const setOpen = (open) => {
root.classList.toggle('is-open', open);
toggle.setAttribute('aria-expanded', String(open));
toggle.setAttribute('aria-label', open ? 'close menu' : 'open menu');
};
const syncHidden = () => {
group.inert = PHONE.matches && !root.classList.contains('is-open');
};
toggle.addEventListener('click', () => {
setOpen(!root.classList.contains('is-open'));
syncHidden();
});
root.addEventListener('keydown', (event) => {
if (event.key !== 'Escape' || !root.classList.contains('is-open')) return;
setOpen(false);
syncHidden();
toggle.focus();
});
PHONE.addEventListener('change', () => {
setOpen(false);
syncHidden();
});
syncHidden();
}
for (const root of document.querySelectorAll('.masthead')) {
setUpLanguage(root);
setUpMenu(root);
}
})();
</script>