design
Typography
Font specimen display with live Google Fonts loading
Install
- Add the package:
npm install @refrakt-md/design - Add it to the
pluginsarray inrefrakt.config.json:"plugins": ["@refrakt-md/design"]
Source
import Markdoc from '@markdoc/markdoc';
import type { Node } from '@markdoc/markdoc';
const { Tag } = Markdoc;
import {
createContentModelSchema,
bodyOnly,
createComponentRenderable,
asNodes,
extractText,
} from '@refrakt-md/runes';
function parseFontEntry(text: string): { role: string; family: string; weights: number[] } | null {
const colonIndex = text.indexOf(':');
if (colonIndex === -1) return null;
const role = text.slice(0, colonIndex).trim();
const rest = text.slice(colonIndex + 1).trim();
const parenMatch = rest.match(/^(.+?)\s*\(([^)]+)\)\s*$/);
if (parenMatch) {
const family = parenMatch[1].trim();
const weights = parenMatch[2]
.split(',')
.map((w) => parseInt(w.trim(), 10))
.filter((w) => !isNaN(w));
return { role, family, weights };
}
return { role, family: rest, weights: [400] };
}
const SIZES = [48, 32, 24, 18, 14];
const WEIGHT_NAMES: Record<number, string> = {
100: 'Thin',
200: 'Extra Light',
300: 'Light',
400: 'Regular',
500: 'Medium',
600: 'Semibold',
700: 'Bold',
800: 'Extra Bold',
900: 'Black',
};
const CHARSET = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 !@#$%^&*()';
const ROLE_FALLBACKS: Record<string, string> = {
heading: 'sans-serif',
body: 'sans-serif',
mono: 'monospace',
display: 'sans-serif',
caption: 'sans-serif',
};
interface Specimen {
role: string;
family: string;
weights: number[];
}
function fontStack(specimen: Specimen): string {
const fallback = ROLE_FALLBACKS[specimen.role] || 'sans-serif';
return `'${specimen.family}', ${fallback}`;
}
function buildFontsUrl(specimens: Specimen[]): string {
if (specimens.length === 0) return '';
const families = specimens.map((s) => {
const name = s.family.replace(/ /g, '+');
const weights = s.weights.sort((a, b) => a - b).join(';');
return `family=${name}:wght@${weights}`;
});
return `https://fonts.googleapis.com/css2?${families.join('&')}&display=swap`;
}
export const typographySections = { title: 'title' } as const;
export const typography = createContentModelSchema({
sections: typographySections,
attributes: {
title: {
type: String,
required: false,
default: '',
description: 'Heading displayed above the typography specimens.',
},
sample: {
type: String,
required: false,
default: 'The quick brown fox jumps over the lazy dog',
description: 'Preview sentence rendered at each size in the specimen cards.',
},
showSizes: {
type: Boolean,
required: false,
default: true,
description: 'Enable/disable the type-size scale samples for each specimen.',
},
showWeights: {
type: Boolean,
required: false,
default: true,
description: 'Enable/disable the weight comparison row for multi-weight fonts.',
},
showCharset: {
type: Boolean,
required: false,
default: false,
description: 'Enable/disable the full character set display for each specimen.',
},
},
contentModel: bodyOnly(),
transform(resolved, attrs) {
const children = asNodes(resolved.body) as Node[];
const specimens: Specimen[] = [];
for (const child of children) {
if (child.type === 'list') {
for (const item of child.children) {
if (item.type === 'item') {
const text = extractText(item);
const entry = parseFontEntry(text);
if (entry) {
specimens.push(entry);
}
}
}
}
}
const sample = attrs.sample as string;
const titleMeta = new Tag('meta', { content: attrs.title });
const showSizesMeta = new Tag('meta', { content: String(attrs.showSizes) });
const showWeightsMeta = new Tag('meta', { content: String(attrs.showWeights) });
const showCharsetMeta = new Tag('meta', { content: String(attrs.showCharset) });
const topChildren: (string | InstanceType<typeof Tag>)[] = [];
const fontsUrl = buildFontsUrl(specimens);
if (fontsUrl) {
topChildren.push(
new Tag('link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }, []),
);
topChildren.push(
new Tag(
'link',
{ rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: 'anonymous' },
[],
),
);
topChildren.push(new Tag('link', { href: fontsUrl, rel: 'stylesheet' }, []));
}
if (attrs.title) {
topChildren.push(new Tag('h3', { 'data-name': 'title' }, [attrs.title as string]));
}
const specimenTags = specimens.map((specimen) => {
const stack = fontStack(specimen);
const specimenChildren: (string | InstanceType<typeof Tag>)[] = [];
specimenChildren.push(
new Tag('div', { 'data-name': 'specimen-header' }, [
new Tag('span', { 'data-name': 'specimen-role' }, [specimen.role]),
new Tag('span', { 'data-name': 'specimen-family' }, [specimen.family]),
]),
);
if (attrs.showSizes) {
const sizeSamples = SIZES.map((size) => {
const text = size <= 18 ? sample : sample.slice(0, Math.floor(60 / (size / 14)));
return new Tag(
'div',
{
'data-name': 'size-sample',
style: `font-family: ${stack}; font-size: ${size}px; font-weight: ${specimen.weights[0]}`,
},
[text, new Tag('span', { 'data-name': 'size-label' }, [`${size}px`])],
);
});
specimenChildren.push(new Tag('div', { 'data-name': 'sizes' }, sizeSamples));
}
if (attrs.showWeights && specimen.weights.length > 1) {
const weightSamples = specimen.weights.map((weight) => {
const label = WEIGHT_NAMES[weight] || String(weight);
return new Tag(
'div',
{
'data-name': 'weight-sample',
style: `font-family: ${stack}; font-weight: ${weight}`,
},
[
new Tag('span', { 'data-name': 'weight-label' }, [`${weight} \u2014 ${label}`]),
new Tag('span', { style: 'font-size: 24px' }, ['Aa Bb Cc']),
],
);
});
specimenChildren.push(new Tag('div', { 'data-name': 'weights' }, weightSamples));
}
if (attrs.showCharset) {
specimenChildren.push(
new Tag(
'div',
{
'data-name': 'charset',
style: `font-family: ${stack}; font-weight: ${specimen.weights[0]}`,
},
[CHARSET],
),
);
}
return new Tag('div', { 'data-name': 'specimen' }, specimenChildren);
});
topChildren.push(new Tag('div', { 'data-name': 'specimens' }, specimenTags));
return createComponentRenderable({
rune: 'typography',
tag: 'section',
properties: {
title: titleMeta,
showSizes: showSizesMeta,
showWeights: showWeightsMeta,
showCharset: showCharsetMeta,
},
children: topChildren,
});
},
});
export function extractTypographyTokens(
node: Node,
): { role: string; family: string; weights: number[]; category: string }[] {
const tokens: { role: string; family: string; weights: number[]; category: string }[] = [];
for (const child of node.children) {
if (child.type === 'list') {
for (const item of child.children) {
if (item.type === 'item') {
const text = extractText(item);
const entry = parseFontEntry(text);
if (entry) {
const category = ROLE_FALLBACKS[entry.role] || 'sans-serif';
tokens.push({
role: entry.role,
family: entry.family,
weights: entry.weights,
category,
});
}
}
}
}
}
return tokens;
}
Displays font specimens for a design system's typefaces, loading each font live.
Basic usage
Define a font system with roles and weights.
{% typography title="Font System" %}
- heading: Inter (600, 700)
- body: Inter (400, 500)
- mono: JetBrains Mono (400, 500)
{% /typography %}<section data-rune="typography" data-rune-fields="{"title":"Font System","showSizes":"true","showWeights":"true","showCharset":"false"}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@600;700&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<h3 data-name="title">Font System</h3>
<div data-name="specimens">
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">heading</span>
<span data-name="specimen-family">Inter</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 48px; font-weight: 600">
The quick brown f
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 600">
The quick brown fox jumps
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 600">
The quick brown fox jumps over the
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 600">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 600">
<span data-name="weight-label">600 — Semibold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 700">
<span data-name="weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">body</span>
<span data-name="specimen-family">Inter</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 48px; font-weight: 400">
The quick brown f
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 400">
The quick brown fox jumps
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 400">
The quick brown fox jumps over the
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 400">
<span data-name="weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 500">
<span data-name="weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">mono</span>
<span data-name="specimen-family">JetBrains Mono</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 48px; font-weight: 400">
The quick brown f
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 32px; font-weight: 400">
The quick brown fox jumps
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 400">
The quick brown fox jumps over the
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'JetBrains Mono', monospace; font-weight: 400">
<span data-name="weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'JetBrains Mono', monospace; font-weight: 500">
<span data-name="weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
</div>
</section>Font System
<section class="rf-typography rf-typography--Font System rf-typography--true rf-typography--true rf-typography--false" data-title="Font System" data-show-sizes="true" data-show-weights="true" data-show-charset="false" data-elevation="flat" data-rune="typography" data-density="full">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@600;700&family=Inter:wght@400;500&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
<h3 data-name="title" class="rf-typography__title" data-section="title">Font System</h3>
<div data-name="specimens" class="rf-typography__specimens">
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">heading</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">Inter</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 48px; font-weight: 600" class="rf-typography__size-sample">
The quick brown f
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 600" class="rf-typography__size-sample">
The quick brown fox jumps
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 600" class="rf-typography__size-sample">
The quick brown fox jumps over the
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 600" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 600" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 600" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">600 — Semibold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 700" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">body</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">Inter</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 48px; font-weight: 400" class="rf-typography__size-sample">
The quick brown f
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 32px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 24px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 18px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Inter', sans-serif; font-size: 14px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 400" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Inter', sans-serif; font-weight: 500" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">mono</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">JetBrains Mono</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 48px; font-weight: 400" class="rf-typography__size-sample">
The quick brown f
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 32px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 24px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 18px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'JetBrains Mono', monospace; font-size: 14px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'JetBrains Mono', monospace; font-weight: 400" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'JetBrains Mono', monospace; font-weight: 500" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
</div>
</section>How Markdown is read
| You write | It becomes |
|---|---|
A list item role: Family (600, 700) | A specimen of that font in each listed weight; the role is heading, body, mono, display or caption |
A list item with no weights, such as body: Inter | A specimen at weight 400 |
Custom sample text
Use the sample attribute to display custom text in specimens.
{% typography title="Display Fonts" sample="Design is intelligence made visible" %}
- display: Playfair Display (400, 700)
- body: Source Sans 3 (400, 600)
{% /typography %}<section data-rune="typography" data-rune-fields="{"title":"Display Fonts","showSizes":"true","showWeights":"true","showCharset":"false"}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Source+Sans+3:wght@400;600&display=swap" rel="stylesheet">
<h3 data-name="title">Display Fonts</h3>
<div data-name="specimens">
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">display</span>
<span data-name="specimen-family">Playfair Display</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 48px; font-weight: 400">
Design is intelli
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 32px; font-weight: 400">
Design is intelligence mad
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 24px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 18px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 14px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'Playfair Display', sans-serif; font-weight: 400">
<span data-name="weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Playfair Display', sans-serif; font-weight: 700">
<span data-name="weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">body</span>
<span data-name="specimen-family">Source Sans 3</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 48px; font-weight: 400">
Design is intelli
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 32px; font-weight: 400">
Design is intelligence mad
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 24px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 18px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 14px; font-weight: 400">
Design is intelligence made visible
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'Source Sans 3', sans-serif; font-weight: 400">
<span data-name="weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Source Sans 3', sans-serif; font-weight: 600">
<span data-name="weight-label">600 — Semibold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
</div>
</section>Display Fonts
<section class="rf-typography rf-typography--Display Fonts rf-typography--true rf-typography--true rf-typography--false" data-title="Display Fonts" data-show-sizes="true" data-show-weights="true" data-show-charset="false" data-elevation="flat" data-rune="typography" data-density="full">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:wght@400;700&family=Source+Sans+3:wght@400;600&display=swap" rel="stylesheet" />
<h3 data-name="title" class="rf-typography__title" data-section="title">Display Fonts</h3>
<div data-name="specimens" class="rf-typography__specimens">
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">display</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">Playfair Display</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 48px; font-weight: 400" class="rf-typography__size-sample">
Design is intelli
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 32px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence mad
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 24px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 18px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Playfair Display', sans-serif; font-size: 14px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'Playfair Display', sans-serif; font-weight: 400" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Playfair Display', sans-serif; font-weight: 700" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">body</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">Source Sans 3</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 48px; font-weight: 400" class="rf-typography__size-sample">
Design is intelli
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 32px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence mad
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 24px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 18px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Source Sans 3', sans-serif; font-size: 14px; font-weight: 400" class="rf-typography__size-sample">
Design is intelligence made visible
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'Source Sans 3', sans-serif; font-weight: 400" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Source Sans 3', sans-serif; font-weight: 600" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">600 — Semibold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
</div>
</div>
</section>Single specimen
A typography rune can show a single font for focused documentation.
{% typography title="Monospace" showCharset=true %}
- mono: Fira Code (400, 500, 700)
{% /typography %}<section data-rune="typography" data-rune-fields="{"title":"Monospace","showSizes":"true","showWeights":"true","showCharset":"true"}">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&display=swap" rel="stylesheet">
<h3 data-name="title">Monospace</h3>
<div data-name="specimens">
<div data-name="specimen">
<div data-name="specimen-header">
<span data-name="specimen-role">mono</span>
<span data-name="specimen-family">Fira Code</span>
</div>
<div data-name="sizes">
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 48px; font-weight: 400">
The quick brown f
<span data-name="size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 32px; font-weight: 400">
The quick brown fox jumps
<span data-name="size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 24px; font-weight: 400">
The quick brown fox jumps over the
<span data-name="size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 18px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 14px; font-weight: 400">
The quick brown fox jumps over the lazy dog
<span data-name="size-label">14px</span>
</div>
</div>
<div data-name="weights">
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 400">
<span data-name="weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 500">
<span data-name="weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 700">
<span data-name="weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
<div data-name="charset" style="font-family: 'Fira Code', monospace; font-weight: 400">AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 !@#$%^&*()</div>
</div>
</div>
</section>Monospace
<section class="rf-typography rf-typography--Monospace rf-typography--true rf-typography--true rf-typography--true" data-title="Monospace" data-show-sizes="true" data-show-weights="true" data-show-charset="true" data-elevation="flat" data-rune="typography" data-density="full">
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="anonymous" />
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;700&display=swap" rel="stylesheet" />
<h3 data-name="title" class="rf-typography__title" data-section="title">Monospace</h3>
<div data-name="specimens" class="rf-typography__specimens">
<div data-name="specimen" class="rf-typography__specimen">
<div data-name="specimen-header" class="rf-typography__specimen-header">
<span data-name="specimen-role" class="rf-typography__specimen-role">mono</span>
<span data-name="specimen-family" class="rf-typography__specimen-family">Fira Code</span>
</div>
<div data-name="sizes" class="rf-typography__sizes">
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 48px; font-weight: 400" class="rf-typography__size-sample">
The quick brown f
<span data-name="size-label" class="rf-typography__size-label">48px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 32px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps
<span data-name="size-label" class="rf-typography__size-label">32px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 24px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the
<span data-name="size-label" class="rf-typography__size-label">24px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 18px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">18px</span>
</div>
<div data-name="size-sample" style="font-family: 'Fira Code', monospace; font-size: 14px; font-weight: 400" class="rf-typography__size-sample">
The quick brown fox jumps over the lazy dog
<span data-name="size-label" class="rf-typography__size-label">14px</span>
</div>
</div>
<div data-name="weights" class="rf-typography__weights">
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 400" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">400 — Regular</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 500" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">500 — Medium</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
<div data-name="weight-sample" style="font-family: 'Fira Code', monospace; font-weight: 700" class="rf-typography__weight-sample">
<span data-name="weight-label" class="rf-typography__weight-label">700 — Bold</span>
<span style="font-size: 24px">Aa Bb Cc</span>
</div>
</div>
<div data-name="charset" style="font-family: 'Fira Code', monospace; font-weight: 400" class="rf-typography__charset">AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789 !@#$%^&*()</div>
</div>
</div>
</section>Attributes
| Attribute | Type | Required | Description |
|---|---|---|---|
title | string | — | Heading displayed above the typography specimens. |
sample | string | — | Preview sentence rendered at each size in the specimen cards. |
showSizes | boolean | — | Enable/disable the type-size scale samples for each specimen. |
showWeights | boolean | — | Enable/disable the weight comparison row for multi-weight fonts. |
showCharset | boolean | — | Enable/disable the full character set display for each specimen. |
Universal attributes
bg
The background layer: image, video, gradient, flat overlay wash and legibility scrim, in a single injected layer behind the rune's content.
| Attribute | Type | Required | Description |
|---|---|---|---|
bg | string | — | Background preset applied to this block |
bg-from | string | — | Gradient start colour — a semantic token name (→ var(--rf-color-*)) |
bg-gradient | "to-t" | "to-b" | "to-l" | "to-r" | "to-tr" | "to-br" | "to-bl" | "to-tl" | — | Gradient direction (bounded named set) |
bg-gradient-type | "linear" | "radial" | "conic" | — | Gradient type |
bg-to | string | — | Gradient end colour — a semantic token name |
bg-via | string | — | Optional middle gradient stop — a semantic token name |
scrim | "top" | "bottom" | "left" | "right" | "none" | — | Scrim direction (heaviest edge); presence turns the scrim on, "none" opts out of the default cover scrim |
scrim-blur | "none" | "sm" | "md" | "lg" | — | Frost scrim blur amount |
scrim-strength | "sm" | "md" | "lg" | — | Gradient scrim strength |
scrim-tone | "dark" | "light" | — | Whether the scrim darkens (for light text) or lightens (for dark text) |
scrim-type | "gradient" | "frost" | — | Scrim treatment: gradient (default) or frost (backdrop blur) |
elevation
How far the rune sits off the page, from sunken to overlay. The theme decides what each step looks like.
| Attribute | Type | Required | Description |
|---|---|---|---|
elevation | "sunken" | "flush" | "flat" | "raised" | "floating" | "overlay" | "none" | "sm" | "md" | "lg" | — | Surface depth, from sunken to overlay. Deprecated: none, sm, md and lg (read as flat, raised, raised and floating) |
inset
Internal padding override.
| Attribute | Type | Required | Description |
|---|---|---|---|
inset | "flush" | "tight" | "default" | "loose" | "breathe" | — | Inner padding of this block |
motion
Scroll-reveal entrance. You choose its character; the theme decides how it moves.
| Attribute | Type | Required | Description |
|---|---|---|---|
reveal | "none" | "fade" | "slide" | "scale" | "blur" | — | Scroll-reveal entrance character (none|fade|slide|scale|blur); the theme owns the choreography |
stagger | boolean | — | Cascade this block's items in as it reveals (no-op on single-child runes) |
prominence
Header emphasis. Scales a rune's header, or its featured quotation; the theme decides the type size for each step.
| Attribute | Type | Required | Description |
|---|---|---|---|
prominence | "quiet" | "normal" | "prominent" | "display" | "marquee" | — | Emphasis of a page-section header or a featured quotation (only on runes that have one) |
spacing
Block-level rhythm override.
| Attribute | Type | Required | Description |
|---|---|---|---|
spacing | "flush" | "tight" | "default" | "loose" | "breathe" | — | Vertical spacing above and below this block |
substrate
Generated pattern fills behind the content, drawn by the theme.
| Attribute | Type | Required | Description |
|---|---|---|---|
substrate | "dots" | "grid" | "lines" | "cross" | "checker" | "none" | — | Generated surface pattern |
substrate-fill | "inherit" | "inset" | — | Surface fill the pattern sits on (full colour stays with tint) |
substrate-opacity | "sm" | "md" | "lg" | — | Pattern ink strength |
substrate-size | "sm" | "md" | "lg" | — | Pattern cell size |
substrate-target | "self" | "media" | — | Which surface the pattern fills (overrides the rune/theme default) |
tint
Per-rune colour override: a named tint from the theme registry, with inline per-token overrides layered on top.
| Attribute | Type | Required | Description |
|---|---|---|---|
tint | string | — | Color tint preset applied to this block |
tint-mode | "auto" | "dark" | "light" | — | Whether the tint adapts to auto, dark, or light mode |
width
The track a block rune occupies.
| Attribute | Type | Required | Description |
|---|---|---|---|
width | "compact" | "narrow" | "content" | "wide" | "full" | — | Maximum width constraint for this block |
| Not available | Why |
|---|---|
| dropcap, reading | this rune declares no prose body |
| frame | this rune declares neither a `frameTarget` nor a media section |