Typed statement
One huge centred two-line statement that types itself in on view, with a floating dark pill counter in the corner.
Part of the style
Tile Ring Blackroom
7 parts that belong together, with their tokens, type and rules.
https://kitbash.me/components/tile-ring-blackroom/statement/figma.html?palette=be78b76d883a158b
Use the Figma MCP server (https://mcp.figma.com/mcp). Download https://kitbash.me/components/tile-ring-blackroom/statement/figma.html?palette=be78b76d883a158b and pass that whole HTML document to the html_to_figma tool, so the part "Typed statement" 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: #e8d8bb;
--night-raised: #ddceb2;
--night-chip: #c8baa2;
--white: #0e0e0e;
--card: #151514;
--ink: #e8d8bb;
--ash: #545047;
--line: #bfb29b;
--line-light: #232220;
--lime: #854239;
--chartreuse: #a86359;
--mint: #ab645b;
--sky: #ab645b;
}
</style>
<section class="statement">
<h2 class="statement__text">
<span class="statement__line">212+ varieties.</span>
<span class="statement__line">New packet every week.</span>
</h2>
<p class="statement__counter" aria-hidden="true">Sown today <span class="statement__dot"></span> <span class="statement__count">038</span></p>
</section>
<style>
.statement {
position: relative;
display: grid;
place-items: center;
min-height: clamp(420px, 50vw, 720px);
padding: var(--section-space) var(--edge);
background: var(--night);
color: var(--white);
}
.statement__text {
margin: 0;
font: var(--weight) var(--display-xl)/var(--leading-tight) var(--font-display);
letter-spacing: var(--track-tight);
text-align: center;
}
.statement__line { display: block; }
.statement__word { display: inline-block; white-space: nowrap; }
.statement__char {
color: var(--night-chip);
transition: color var(--quick) ease;
}
.statement__char.is-typed { color: var(--white); }
.statement__char.is-caret { box-shadow: inset -0.06em 0 0 var(--lime); }
.statement__counter {
position: absolute;
right: var(--edge);
bottom: var(--edge);
display: flex;
align-items: center;
gap: var(--space-s);
margin: 0;
height: var(--control);
padding: 0 24px;
border-radius: var(--radius-pill);
background: var(--night-chip);
font: var(--weight) var(--text-s)/1 var(--font-mono);
text-transform: uppercase;
}
.statement__dot {
width: 6px;
height: 6px;
background: var(--lime);
}
.statement__count { font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
.statement__text { font-size: clamp(36px, 10vw, 56px); }
.statement__counter { height: 40px; padding: 0 16px; font-size: var(--text-xs); }
}
</style>
<script>
(() => {
const still = matchMedia('(prefers-reduced-motion: reduce)').matches;
for (const root of document.querySelectorAll('.statement')) {
const chars = [];
for (const line of root.querySelectorAll('.statement__line')) {
const text = line.textContent;
line.setAttribute('aria-label', text);
line.textContent = '';
text.split(/(\s+)/).forEach((part) => {
if (!part) return;
if (/^\s+$/.test(part)) { line.append(part); return; }
const word = document.createElement('span');
word.className = 'statement__word';
word.setAttribute('aria-hidden', 'true');
for (const letter of part) {
const span = document.createElement('span');
span.className = 'statement__char';
span.textContent = letter;
word.append(span);
chars.push(span);
}
line.append(word);
});
}
const count = root.querySelector('.statement__count');
const start = Number(count.textContent) || 0;
const show = (n) => {
chars.forEach((c, i) => {
c.classList.toggle('is-typed', i < n);
c.classList.toggle('is-caret', i === n - 1 && n < chars.length);
});
count.textContent = String(start + n).padStart(3, '0');
};
if (still) { show(chars.length); continue; }
let timer = 0;
let typed = 0;
const run = () => {
clearInterval(timer);
timer = setInterval(() => {
typed += 1;
show(typed);
if (typed >= chars.length) clearInterval(timer);
}, 28);
};
new IntersectionObserver((entries) => {
for (const entry of entries) {
if (entry.isIntersecting && typed < chars.length) run();
else clearInterval(timer);
}
}, { threshold: 0.3 }).observe(root);
}
})();
</script>