Top bar
Bold wordmark with an italic edition note, centred text links with an underlined current page, a green outlined language pill with a small menu, and a bold buy link with a superscript price.
Part of the style
Graph Paper Novel
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/graph-paper-novel/bar/figma.html?palette=082e6be54802fa2a
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/graph-paper-novel/bar/figma.html?palette=082e6be54802fa2a and pass that whole HTML document to the html_to_figma tool, so the part "Top bar" 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 {
--page: #f1f1f1;
--grid-line: #e0dfdd;
--ink: #2c1608;
--ink-soft: #655348;
--ink-dim: #c5c2bd;
--panel: #e7e7e5;
--sheet: #fdfdfd;
--on-dark: #1f1f1f;
--metal-light: #fbfbfb;
--metal-mid: #aaa79e;
--metal-dark: #5a473b;
--shade: rgba(44, 22, 8, 0.3);
--shade-light: rgba(44, 22, 8, 0.1);
--sheen: rgba(255, 255, 255, 0.1);
--green: #d86d02;
--green-hover: #381902;
--scribble: #e2a278;
}
</style>
<header class="bar">
<a class="bar__brand" href="#">
<strong class="bar__name">True North</strong>
<em class="bar__edition">2027 Edition</em>
</a>
<nav class="bar__nav" aria-label="Sections">
<a class="bar__link is-current" href="#" aria-current="page">Intro</a>
<a class="bar__link" href="#">The book</a>
<a class="bar__link" href="#">About the Author</a>
</nav>
<div class="bar__lang">
<button class="bar__pill" type="button" aria-expanded="false" aria-haspopup="true">
<span class="bar__pill-label">En</span>
<svg class="bar__chevron" viewBox="0 0 10 6" width="8" height="5" aria-hidden="true"><path d="M1 1l4 4 4-4" fill="none" stroke="currentColor" stroke-width="1.4"/></svg>
</button>
<ul class="bar__menu" role="menu">
<li><button class="bar__option" type="button" role="menuitem">En</button></li>
<li><button class="bar__option" type="button" role="menuitem">Es</button></li>
<li><button class="bar__option" type="button" role="menuitem">Fr</button></li>
<li><button class="bar__option" type="button" role="menuitem">Pt</button></li>
</ul>
</div>
<a class="bar__buy" href="#">Buy it now!<sup class="bar__price">$2.49</sup></a>
</header>
<style>
.bar {
display: grid;
grid-template-columns: 1fr auto auto 1fr;
align-items: center;
gap: var(--gap);
padding: 0.75rem var(--edge);
font-size: var(--text-s);
font-weight: 400;
}
.bar a { color: inherit; }
.bar__brand {
display: inline-flex;
gap: 0.75rem;
min-height: var(--tap);
align-items: center;
text-decoration: none;
white-space: nowrap;
}
.bar__name { font-weight: 600; letter-spacing: 0; }
.bar__edition { font-weight: 300; font-style: italic; }
.bar__nav { display: flex; gap: clamp(1rem, 4vw, 3.75rem); }
.bar__link,
.bar__buy {
display: inline-flex;
align-items: center;
justify-content: center;
min-width: var(--tap);
min-height: var(--tap);
text-decoration: underline;
text-decoration-color: transparent;
text-decoration-thickness: 1px;
text-underline-offset: 0.2em;
transition: text-decoration-color var(--quick) ease;
}
.bar__link:hover,
.bar__link:focus-visible { text-decoration-color: currentColor; }
.bar__link.is-current {
font-weight: 600;
text-decoration-color: currentColor;
text-decoration-thickness: 2px;
}
.bar__lang { position: relative; }
.bar__pill {
display: inline-flex;
align-items: center;
justify-content: center;
gap: 0.3rem;
min-width: var(--tap);
height: var(--tap);
padding: 0 0.9rem;
border: none;
background: none;
color: var(--green);
font: italic 400 var(--text-s) var(--font-body);
cursor: pointer;
}
/* The drawn pill is smaller than its tap area, like the source. */
.bar__pill::before {
content: "";
position: absolute;
inset: 0.4rem 0;
border: var(--rule) solid var(--green);
border-radius: var(--radius-pill);
transition: background-color var(--quick) ease;
}
.bar__pill:hover::before { background: color-mix(in srgb, var(--green) 8%, transparent); }
.bar__chevron { transition: rotate var(--quick) var(--ease); }
.bar__lang.is-open .bar__chevron { rotate: 180deg; }
.bar__menu {
position: absolute;
top: calc(100% + 0.25rem);
left: 50%;
z-index: 5;
translate: -50% -0.25rem;
margin: 0;
padding: 0.25rem;
list-style: none;
border: var(--rule) solid var(--green);
border-radius: 1.5rem;
background: var(--page);
opacity: 0;
visibility: hidden;
transition: opacity var(--quick) ease, translate var(--quick) var(--ease), visibility 0s var(--quick);
}
.bar__lang.is-open .bar__menu {
translate: -50% 0;
opacity: 1;
visibility: visible;
transition-delay: 0s;
}
.bar__option {
width: var(--tap);
height: var(--tap);
border: 0;
border-radius: 50%;
background: none;
color: var(--green);
font: italic 400 var(--text-s) var(--font-body);
cursor: pointer;
}
.bar__option:hover,
.bar__option:focus-visible { background: var(--green); color: var(--on-dark); }
.bar__buy {
justify-self: end;
align-items: flex-start;
padding-top: 0.6rem;
font-weight: 600;
text-decoration-color: currentColor;
text-decoration-thickness: 2px;
white-space: nowrap;
}
.bar__buy:hover { text-decoration-color: var(--green); }
.bar__price {
margin-left: 0.35rem;
font-size: 0.7em;
font-weight: 300;
text-decoration: none;
display: inline-block;
}
@media (max-width: 52rem) {
.bar { grid-template-columns: 1fr auto auto; gap: 0.5rem; }
.bar__nav { display: none; }
.bar__edition { display: none; }
.bar__name { font-size: 1.15rem; }
.bar__buy { font-size: 1.15rem; }
}
</style>
<script>
(() => {
for (const lang of document.querySelectorAll('.bar__lang')) {
const pill = lang.querySelector('.bar__pill');
const label = lang.querySelector('.bar__pill-label');
const setOpen = (open) => {
lang.classList.toggle('is-open', open);
pill.setAttribute('aria-expanded', String(open));
};
pill.addEventListener('click', () => setOpen(!lang.classList.contains('is-open')));
for (const option of lang.querySelectorAll('.bar__option')) {
option.addEventListener('click', () => {
label.textContent = option.textContent;
setOpen(false);
pill.focus();
});
}
lang.addEventListener('keydown', (event) => {
if (event.key === 'Escape') setOpen(false);
});
lang.addEventListener('focusout', (event) => {
if (!lang.contains(event.relatedTarget)) setOpen(false);
});
}
})();
</script>