The brand's type scale as one part. Funnel Display Regular for titles, DM Sans for text, Medium for small and labels, labels in capitals with 6% tracking, Geist Mono for code. Every variant is a type utility from the tokens.
Install
React apps get the React files; every other stack gets the web component.
Type what you are looking for and find the creative that matches.
Paragraph
DM Sans 16px at 1.33
Save the ads that work to a board, and come back to them when you brief the next one.
Interface
DM Sans 14px at 1.3
Saved to Acme hooks.
Small
DM Sans Medium 14px at 1.3
12 new creatives
Muted
DM Sans 14px, muted
Updated 4 minutes ago.
Caption
DM Sans 12px at 1.3, muted
$10 for your first month, then $20/month.
Label
DM Sans Medium 12px, capitals, 6% tracking
Most popular
Code
Geist Mono 14px at 1.3
acme-hooks
An article
Field notes
How Acme found its best hook.
Three weeks, one board and every ad in its category.
Acme searched for the creative its rivals ran longest. Long runs mean an ad pays for itself, so the board filled with the ones worth studying.
What the board showed
The ads that lasted opened on the product in a hand, not on a logo. They said the price in the first line.
The first second sells the next ten.
What Acme changed
Open on the product, in use.
Say the offer in the first line.
Cut every ad to under fifteen seconds.
Try it on your category
Save a search to a board named acme-hooks and check it each week.
$10 for your first month, then $20/month.
Acme Studio plan
Billed monthly.
Usage
Any text: page and card titles, a lead under a hero, body copy, captions, the capital label over a field or a plan, inline code. Pick the step by role, not by look.
Never
A size, weight or line height outside the scale: every step comes from tokens.css
Bold or semibold: Funnel Display and DM Sans run at Regular and Medium only
Capitals anywhere but labels, and labels without the 6% tracking
Funnel Display for body text, or DM Sans for titles
Spectrum colors on text: type is White on Black, muted in the neutral steps
Props
The web component takes the same as attributes or properties (<spyglass-text>); title is heading there.
<Text>
Prop
Type
Default
variant
TextVariant
The step of the scale: display, hero, h1 to h4 (Funnel Display), lead, large, p, ui, small, muted, caption (DM Sans), label (capitals), blockquote or code.
'p'
as
string
The tag, in place of the variant's own (an h2 drawn as h1, a span drawn as caption).
children
ReactNode
Examples
The same example in React and as web components; both render identically.
react/examples/typography/Scale.tsx
import { Text } from '@/react/components/ui/Text'
// Every step of the brand's type scale, with the face, size and line height it takes from the tokens.
export default function Scale() {
return (
<div className="flex flex-col">
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Display</Text><Text variant="caption">Funnel Display 64px at 1.07</Text></div>
<Text variant="display">Find the ads that work.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Hero</Text><Text variant="caption">Funnel Display 48px at 1.07</Text></div>
<Text variant="hero">The only creative search engine.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Heading 1</Text><Text variant="caption">Funnel Display 36px at 1.07</Text></div>
<Text variant="h1">Search ads by what is in them.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Heading 2</Text><Text variant="caption">Funnel Display 28px at 1.0</Text></div>
<Text variant="h2">Creator plan</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Heading 3</Text><Text variant="caption">Funnel Display 24px at 1.07</Text></div>
<Text variant="h3">Boards for every brand</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Heading 4</Text><Text variant="caption">Funnel Display 20px at 1.07</Text></div>
<Text variant="h4">Track a competitor</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Lead</Text><Text variant="caption">DM Sans 18px at 1.33, muted</Text></div>
<Text variant="lead">Type what you are looking for and find the creative that matches.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Paragraph</Text><Text variant="caption">DM Sans 16px at 1.33</Text></div>
<Text variant="p">Save the ads that work to a board, and come back to them when you brief the next one.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Interface</Text><Text variant="caption">DM Sans 14px at 1.3</Text></div>
<Text variant="ui">Saved to Acme hooks.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Small</Text><Text variant="caption">DM Sans Medium 14px at 1.3</Text></div>
<Text variant="small">12 new creatives</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Muted</Text><Text variant="caption">DM Sans 14px, muted</Text></div>
<Text variant="muted">Updated 4 minutes ago.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Caption</Text><Text variant="caption">DM Sans 12px at 1.3, muted</Text></div>
<Text variant="caption">$10 for your first month, then $20/month.</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Label</Text><Text variant="caption">DM Sans Medium 12px, capitals, 6% tracking</Text></div>
<Text variant="label">Most popular</Text>
</div>
<div className="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div className="flex shrink-0 flex-col gap-1 md:w-56"><Text variant="label">Code</Text><Text variant="caption">Geist Mono 14px at 1.3</Text></div>
<Text variant="code">acme-hooks</Text>
</div>
</div>
)
}
elements/examples/typography/Scale.html
<!-- Every step of the brand's type scale, with the face, size and line height it takes from the tokens. -->
<div class="flex flex-col">
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Display</spyglass-text><spyglass-text variant="caption">Funnel Display 64px at 1.07</spyglass-text></div>
<spyglass-text variant="display">Find the ads that work.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Hero</spyglass-text><spyglass-text variant="caption">Funnel Display 48px at 1.07</spyglass-text></div>
<spyglass-text variant="hero">The only creative search engine.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Heading 1</spyglass-text><spyglass-text variant="caption">Funnel Display 36px at 1.07</spyglass-text></div>
<spyglass-text variant="h1">Search ads by what is in them.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Heading 2</spyglass-text><spyglass-text variant="caption">Funnel Display 28px at 1.0</spyglass-text></div>
<spyglass-text variant="h2">Creator plan</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Heading 3</spyglass-text><spyglass-text variant="caption">Funnel Display 24px at 1.07</spyglass-text></div>
<spyglass-text variant="h3">Boards for every brand</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Heading 4</spyglass-text><spyglass-text variant="caption">Funnel Display 20px at 1.07</spyglass-text></div>
<spyglass-text variant="h4">Track a competitor</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Lead</spyglass-text><spyglass-text variant="caption">DM Sans 18px at 1.33, muted</spyglass-text></div>
<spyglass-text variant="lead">Type what you are looking for and find the creative that matches.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Paragraph</spyglass-text><spyglass-text variant="caption">DM Sans 16px at 1.33</spyglass-text></div>
<spyglass-text variant="p">Save the ads that work to a board, and come back to them when you brief the next one.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Interface</spyglass-text><spyglass-text variant="caption">DM Sans 14px at 1.3</spyglass-text></div>
<spyglass-text variant="ui">Saved to Acme hooks.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Small</spyglass-text><spyglass-text variant="caption">DM Sans Medium 14px at 1.3</spyglass-text></div>
<spyglass-text variant="small">12 new creatives</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Muted</spyglass-text><spyglass-text variant="caption">DM Sans 14px, muted</spyglass-text></div>
<spyglass-text variant="muted">Updated 4 minutes ago.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Caption</spyglass-text><spyglass-text variant="caption">DM Sans 12px at 1.3, muted</spyglass-text></div>
<spyglass-text variant="caption">$10 for your first month, then $20/month.</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Label</spyglass-text><spyglass-text variant="caption">DM Sans Medium 12px, capitals, 6% tracking</spyglass-text></div>
<spyglass-text variant="label">Most popular</spyglass-text>
</div>
<div class="flex flex-col gap-2 border-b border-edge py-6 md:flex-row md:items-baseline md:gap-8">
<div class="flex shrink-0 flex-col gap-1 md:w-56"><spyglass-text variant="label">Code</spyglass-text><spyglass-text variant="caption">Geist Mono 14px at 1.3</spyglass-text></div>
<spyglass-text variant="code">acme-hooks</spyglass-text>
</div>
</div>
react/examples/typography/Article.tsx
import { Text } from '@/react/components/ui/Text'
// shadcn's typography page in the brand: headings, a lead, paragraphs, a quote, a list and inline code, each a step of
// the scale.
export default function Article() {
return (
<article className="flex max-w-2xl flex-col">
<Text variant="label">Field notes</Text>
<Text variant="h1" className="mt-4">How Acme found its best hook.</Text>
<Text variant="lead" className="mt-4">Three weeks, one board and every ad in its category.</Text>
<Text variant="p" className="mt-6">Acme searched for the creative its rivals ran longest. Long runs mean an ad pays for itself, so the board filled with the ones worth studying.</Text>
<Text variant="h2" className="mt-10">What the board showed</Text>
<Text variant="p" className="mt-4">The ads that lasted opened on the product in a hand, not on a logo. They said the price in the first line.</Text>
<Text variant="blockquote" className="mt-6">The first second sells the next ten.</Text>
<Text variant="h3" className="mt-10">What Acme changed</Text>
<ul className="mt-4 flex list-disc flex-col gap-2 pl-6 type-body text-fg">
<li>Open on the product, in use.</li>
<li>Say the offer in the first line.</li>
<li>Cut every ad to under fifteen seconds.</li>
</ul>
<Text variant="h4" className="mt-10">Try it on your category</Text>
<Text variant="p" className="mt-4">Save a search to a board named <Text variant="code" as="code">acme-hooks</Text> and check it each week.</Text>
<Text variant="large" className="mt-6">$10 for your first month, then $20/month.</Text>
<Text variant="small" className="mt-2">Acme Studio plan</Text>
<Text variant="muted" className="mt-1">Billed monthly.</Text>
</article>
)
}
elements/examples/typography/Article.html
<!-- shadcn's typography page in the brand: headings, a lead, paragraphs, a quote, a list and inline code, each a step of
the scale. -->
<article class="flex max-w-2xl flex-col">
<spyglass-text variant="label">Field notes</spyglass-text>
<spyglass-text variant="h1" class="mt-4">How Acme found its best hook.</spyglass-text>
<spyglass-text variant="lead" class="mt-4">Three weeks, one board and every ad in its category.</spyglass-text>
<spyglass-text variant="p" class="mt-6">Acme searched for the creative its rivals ran longest. Long runs mean an ad pays for itself, so the board filled with the ones worth studying.</spyglass-text>
<spyglass-text variant="h2" class="mt-10">What the board showed</spyglass-text>
<spyglass-text variant="p" class="mt-4">The ads that lasted opened on the product in a hand, not on a logo. They said the price in the first line.</spyglass-text>
<spyglass-text variant="blockquote" class="mt-6">The first second sells the next ten.</spyglass-text>
<spyglass-text variant="h3" class="mt-10">What Acme changed</spyglass-text>
<ul class="mt-4 flex list-disc flex-col gap-2 pl-6 type-body text-fg">
<li>Open on the product, in use.</li>
<li>Say the offer in the first line.</li>
<li>Cut every ad to under fifteen seconds.</li>
</ul>
<spyglass-text variant="h4" class="mt-10">Try it on your category</spyglass-text>
<spyglass-text variant="p" class="mt-4">Save a search to a board named <spyglass-text variant="code" as="code">acme-hooks</spyglass-text> and check it each week.</spyglass-text>
<spyglass-text variant="large" class="mt-6">$10 for your first month, then $20/month.</spyglass-text>
<spyglass-text variant="small" class="mt-2">Acme Studio plan</spyglass-text>
<spyglass-text variant="muted" class="mt-1">Billed monthly.</spyglass-text>
</article>
Source
react/components/ui/Text.tsx
import type { ElementType, HTMLAttributes, ReactNode } from 'react'
import { cn } from '@/react/lib/cn'
// The brand's type scale as one part, every variant one of the theme's type utilities and nothing else (tokens.css):
// Funnel Display Regular for titles (display 64px, hero 48px, h1 36px, h2 28px, h3 24px, h4 20px, at 1.07, the card
// title's 1.0 for h2), DM Sans for text (lead and large 18px, p 16px at 1.33, ui 14px, small 14px Medium, caption
// 12px), labels in capitals with 6% tracking (DM Sans Medium 12px), and Geist Mono for inline code. Muted text is the
// #A3A3A3 neutral step. `as` overrides the tag; className is appended last (a margin, a width).
export type TextVariant = 'display' | 'hero' | 'h1' | 'h2' | 'h3' | 'h4' | 'lead' | 'large' | 'p' | 'ui' | 'small' | 'muted' | 'caption' | 'label' | 'blockquote' | 'code'
export const TEXT_TAGS: Record<TextVariant, string> = {
display: 'h1', hero: 'h1', h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4',
lead: 'p', large: 'p', p: 'p', ui: 'p', small: 'p', muted: 'p', caption: 'p', label: 'p', blockquote: 'blockquote', code: 'code',
}
export const TEXT_CLASSES: Record<TextVariant, string> = {
display: 'type-display text-fg',
hero: 'type-hero text-fg',
h1: 'type-heading-1 text-fg',
h2: 'type-heading-2 text-fg',
h3: 'type-heading-3 text-fg',
h4: 'type-heading-4 text-fg',
lead: 'type-body-lg text-fg-muted',
large: 'type-body-lg text-fg',
p: 'type-body text-fg',
ui: 'type-ui text-fg',
small: 'type-ui-strong text-fg',
muted: 'type-ui text-fg-muted',
caption: 'type-caption text-fg-muted',
label: 'type-label text-fg-soft',
blockquote: 'border-l-2 border-edge-strong pl-6 type-body-lg text-fg-soft',
code: 'rounded-ds-sm bg-surface-subtle px-1 py-0.5 type-code text-fg',
}
export interface TextProps extends HTMLAttributes<HTMLElement> {
/** The step of the scale: display, hero, h1 to h4 (Funnel Display), lead, large, p, ui, small, muted, caption (DM Sans), label (capitals), blockquote or code. */
variant?: TextVariant
/** The tag, in place of the variant's own (an h2 drawn as h1, a span drawn as caption). */
as?: string
children?: ReactNode
}
export function Text({ variant = 'p', as, className, children, ...rest }: TextProps) {
const v = TEXT_CLASSES[variant] ? variant : 'p'
const Tag = (as ?? TEXT_TAGS[v]) as ElementType
return <Tag data-ds="text" className={cn(TEXT_CLASSES[v], className)} {...rest}>{children}</Tag>
}
export default Text
react/lib/cn.ts
// Joins class names, skipping falsy ones: cn('a', on && 'b', ['c', undefined]). It does not merge conflicting
// utilities (no tailwind-merge), as Vue's class binding does not: the library's classes are written not to compete,
// and a className from the caller is appended after them, as Vue appends a fallthrough class.
export type ClassValue = string | false | null | undefined | 0 | ClassValue[]
export function cn(...values: ClassValue[]): string {
const out: string[] = []
for (const v of values) {
if (!v) continue
if (Array.isArray(v)) {
const s = cn(...v)
if (s) out.push(s)
}
else out.push(v)
}
return out.join(' ')
}
elements/components/ui/text.ts
import { html, unsafeStatic } from 'lit/static-html.js'
import { DsElement, define, HostLayoutController } from '@/elements/lib/element'
import styles from 'virtual:tw'
// Text.tsx as <spyglass-text>: the brand's type scale as one part, every variant one of the theme's type utilities
// (Funnel Display titles, DM Sans text, capital labels with 6% tracking, Geist Mono code). It draws the variant's tag
// in its shadow root with the same classes as React; `as` overrides the tag. Layout classes on the element (a margin,
// a width) land on the tag it draws.
export type TextVariant = 'display' | 'hero' | 'h1' | 'h2' | 'h3' | 'h4' | 'lead' | 'large' | 'p' | 'ui' | 'small' | 'muted' | 'caption' | 'label' | 'blockquote' | 'code'
const TAGS: Record<TextVariant, string> = {
display: 'h1', hero: 'h1', h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4',
lead: 'p', large: 'p', p: 'p', ui: 'p', small: 'p', muted: 'p', caption: 'p', label: 'p', blockquote: 'blockquote', code: 'code',
}
const CLASSES: Record<TextVariant, string> = {
display: 'type-display text-fg',
hero: 'type-hero text-fg',
h1: 'type-heading-1 text-fg',
h2: 'type-heading-2 text-fg',
h3: 'type-heading-3 text-fg',
h4: 'type-heading-4 text-fg',
lead: 'type-body-lg text-fg-muted',
large: 'type-body-lg text-fg',
p: 'type-body text-fg',
ui: 'type-ui text-fg',
small: 'type-ui-strong text-fg',
muted: 'type-ui text-fg-muted',
caption: 'type-caption text-fg-muted',
label: 'type-label text-fg-soft',
blockquote: 'border-l-2 border-edge-strong pl-6 type-body-lg text-fg-soft',
code: 'rounded-ds-sm bg-surface-subtle px-1 py-0.5 type-code text-fg',
}
// The tags a page may ask for.
const ALLOWED = new Set(['h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'p', 'span', 'div', 'blockquote', 'code', 'strong', 'em', 'small', 'label', 'li', 'figcaption'])
/**
* @summary The brand's type scale: Funnel Display titles, DM Sans text, capital labels, Geist Mono code.
* @slot - The text.
*/
export class Text extends DsElement {
static styles = [DsElement.styles, styles]
protected readonly layout = new HostLayoutController(this, () => this.renderRoot.querySelector<HTMLElement>('[data-ds="text"]'))
static properties = { variant: { reflect: true }, as: {} }
/** The step of the scale: display, hero, h1 to h4, lead, large, p, ui, small, muted, caption, label, blockquote or code. */
variant: TextVariant = 'p'
/** The tag, in place of the variant's own. */
as?: string
private get tag() {
const v = CLASSES[this.variant] ? this.variant : 'p'
const t = (this.as ?? TAGS[v]).toLowerCase()
return ALLOWED.has(t) ? t : TAGS[v]
}
render() {
const v = CLASSES[this.variant] ? this.variant : 'p'
const t = unsafeStatic(this.tag)
return html`<${t} data-ds="text" class=${CLASSES[v]}><slot></slot></${t}>`
}
}
define('text', Text)
Reference: The type pages of the brand guidelines (Funnel Display, DM Sans) and the sizes measured on the 1080 canvas, scaled to the product (tokens.css header); Geist Mono from the ASCII texture.