Typewriter Letter Hero 1
Typewriter letter hero: a 'Dear friend' sales letter types its hook while handwritten margin notes on a softly textured gutter lead the eye down to the P.S. button, which carries the offer and its price.
Use it in a prompt
Use attention/typewriter-letter-hero from the FunnelDNA library. Follow the skill and theme contract. Ask me for the copy, images, and brand details you need; do not invent proof.
Paste into Claude or ChatGPT with FunnelDNA connected (MCP setup), or alongside the skill.
Use it in code
- Save
component.tsx(Code tab) ascomponents/funneldna/attention/typewriter-letter-hero.tsx. - Import it and pass your copy and images (Props tab):
import { TypewriterLetterHero } from "@/components/funneldna/attention/typewriter-letter-hero"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/attention/typewriter-letter-hero/component.tsx 545 lines
// layout: letter-margin-notes
// Typewriter letter hero: a 'Dear friend' sales letter types its hook while handwritten margin notes on a softly textured gutter lead the eye down to the P.S. button, which carries the offer and its price.
import * as React from 'react'
import { Download, Pause, Play, ShieldCheck } from 'lucide-react'
export type TypewriterLetterHeroItem = {
name: string
/** Product photo for the enclosures tape (slot: item-n). */
image?: string
/** Alt text for the product photo; empty when the name already says it. */
imageAlt?: string
}
export type TypewriterLetterHeroProps = {
/** Opening line of the letter, e.g. "Dear friend,". */
salutation?: string
/** Hook that types itself in; always fully present for screen readers. */
headline?: string
/** Phrase inside the headline that gets the single marker stroke. */
emphasis?: string
/** Heading element used for the headline. */
headingLevel?: 'h1' | 'h2'
/** Body sentence under the headline; may carry rich text. */
lead?: React.ReactNode
/** Handwritten margin note beside the headline. */
hookNote?: string
/** Tag that opens the P.S. line. */
psLabel?: string
/** The P.S. question the button answers. */
question?: string
/** Button first line. */
actionLabel?: string
/** Button second line: the offer and its price. */
actionSubline?: string
/** Handwritten margin note beside the button. */
actionNote?: string
/** Short reassurance lines under the button; guarantee lines get a shield icon, others a download icon. */
reassurance?: string[]
/** Subtle paper texture for the margin gutter and the sheet underneath (slot: texture). */
textureImage?: string
/** Label in front of the enclosures tape. */
enclosuresLabel?: string
/** What the visitor gets, shown on the moving enclosures tape. */
enclosures?: TypewriterLetterHeroItem[]
/** Accessible label for the pause-motion control. */
pauseLabel?: string
/** Accessible label for the play-motion control. */
playLabel?: string
/** Navigation destination; renders the button as a link when set and enabled. */
href?: string
/** Called when the button or link is clicked. */
onAction?: (event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void
disabled?: boolean
/** Forced visual state for previews; 'default' runs the typewriter entrance. */
state?: 'default' | 'hover' | 'active' | 'disabled'
className?: string
}
export function TypewriterLetterHero(props: TypewriterLetterHeroProps) {
const {
salutation = 'Dear friend,',
headline = 'Build your first funnel with a clear plan',
emphasis = 'a clear plan',
headingLevel = 'h1',
lead = 'Plan your funnel, write your page copy, and check every step before you launch.',
hookNote = 'Start with the plan.',
psLabel = 'P.S.',
question = 'Ready to map your first funnel?',
actionLabel = 'I’m ready, send me the kit',
actionSubline = 'The Funnel Starter Kit · $47',
actionNote = 'Your next step',
reassurance = ['Instant digital access', '30-day money-back guarantee'],
textureImage,
enclosuresLabel = 'Enclosed:',
enclosures = [],
pauseLabel = 'Pause motion',
playLabel = 'Play motion',
href,
onAction,
disabled = false,
state = 'default',
className,
} = props
const isDisabled = disabled || state === 'disabled'
const total = headline.length
const tapeId = React.useId()
const [count, setCount] = React.useState(total)
const [entrance, setEntrance] = React.useState(false)
const [reduce, setReduce] = React.useState(false)
const [paused, setPaused] = React.useState(false)
useIsoLayoutEffect(() => {
const mq = window.matchMedia('(prefers-reduced-motion: reduce)')
const sync = () => setReduce(mq.matches)
sync()
mq.addEventListener('change', sync)
return () => mq.removeEventListener('change', sync)
}, [])
/* Typewriter entrance. The full headline is always in the DOM for readers and layout;
untyped letters show as a faint carbon impression so nothing shifts or hides. */
useIsoLayoutEffect(() => {
if (reduce || state !== 'default') {
setEntrance(false)
setCount(total)
return
}
setEntrance(true)
setCount(0)
let i = 0
let timer = 0
const tick = () => {
i += 1
setCount(i)
if (i >= total) return
const ch = headline.charAt(i - 1)
const wait = ch === ' ' ? 22 : /[.,!?;:]/.test(ch) ? 160 : 34
timer = window.setTimeout(tick, wait)
}
timer = window.setTimeout(tick, 380)
return () => window.clearTimeout(timer)
}, [reduce, state, headline, total])
const done = count >= total
const segs = splitPhrase(headline, emphasis)
let offset = 0
const visual = segs.map((seg, idx) => {
const start = offset
const len = seg.text.length
offset += len
const n = Math.max(0, Math.min(len, count - start))
const isLast = idx === segs.length - 1
const caretHere = count >= start && (count < start + len || isLast)
const inner = (
<>
<span className='cf-twl__typed'>{seg.text.slice(0, n)}</span>
{caretHere ? <span className='cf-twl__caret' /> : null}
<span className='cf-twl__ghost'>{seg.text.slice(n)}</span>
</>
)
return seg.em ? (
<span key={idx} className={count >= start + len ? 'cf-twl__em is-on' : 'cf-twl__em'}>
{inner}
</span>
) : (
<React.Fragment key={idx}>{inner}</React.Fragment>
)
})
const Heading = headingLevel
const ctaInner = (
<>
<span className='cf-twl__cta-label'>{actionLabel}</span>
{actionSubline ? <span className='cf-twl__cta-sub'>{actionSubline}</span> : null}
</>
)
const cta =
href && !isDisabled ? (
<a className='cf-twl__cta' href={href} onClick={onAction}>
{ctaInner}
</a>
) : (
<button type='button' className='cf-twl__cta' disabled={isDisabled} onClick={onAction}>
{ctaInner}
</button>
)
const showTape = enclosures.length > 0
const groups = reduce ? 1 : 4
const pauseButton = !reduce ? (
<button
type='button'
className={showTape ? 'cf-twl__pause' : 'cf-twl__pause cf-twl__pause--inline'}
aria-label={paused ? playLabel : pauseLabel}
onClick={() => setPaused((p) => !p)}
>
{paused ? <Play aria-hidden='true' size={16} strokeWidth={2.5} /> : <Pause aria-hidden='true' size={16} strokeWidth={2.5} />}
</button>
) : null
const rootStyle = textureImage
? ({ '--twl-texture': `url(${JSON.stringify(textureImage)})` } as React.CSSProperties)
: undefined
return (
<div
className={['cf-twl', className].filter(Boolean).join(' ')}
style={rootStyle}
data-motion={entrance ? 'on' : 'off'}
data-done={done ? 'true' : 'false'}
data-paused={paused ? 'true' : 'false'}
data-textured={textureImage ? 'true' : 'false'}
data-state={state}
>
<style>{CSS}</style>
<div className='cf-twl__under' aria-hidden='true' />
<article className='cf-twl__sheet'>
<div className='cf-twl__margin' aria-hidden='true' />
<div className='cf-twl__letter'>
<p className='cf-twl__salute'>{salutation}</p>
<div className='cf-twl__hook'>
<Heading className='cf-twl__h'>
<span className='cf-twl__sr'>{headline}</span>
<span aria-hidden='true'>{visual}</span>
</Heading>
{hookNote ? (
<div className='cf-twl__cue cf-twl__cue--hook'>
<p className='cf-twl__note'>{hookNote}</p>
</div>
) : null}
</div>
{lead ? <p className='cf-twl__lead'>{lead}</p> : null}
<div className='cf-twl__ps'>
<p className='cf-twl__ask'>
<span className='cf-twl__ps-tag'>{psLabel}</span> {question}
</p>
<div className='cf-twl__act'>
{actionNote ? (
<div className='cf-twl__cue cf-twl__cue--act'>
<p className='cf-twl__note'>{actionNote}</p>
</div>
) : null}
{cta}
</div>
{reassurance.length > 0 ? (
<ul className='cf-twl__assure'>
{reassurance.map((line) => {
const Icon = /guarantee|money-back|refund/i.test(line) ? ShieldCheck : Download
return (
<li key={line}>
<Icon aria-hidden='true' size={17} strokeWidth={2.25} />
<span>{line}</span>
</li>
)
})}
</ul>
) : null}
{!showTape ? pauseButton : null}
</div>
</div>
{showTape ? (
<div className='cf-twl__tape'>
<span className='cf-twl__tape-label' id={tapeId}>
{enclosuresLabel}
</span>
<div className='cf-twl__viewport'>
<div className='cf-twl__track'>
{Array.from({ length: groups }, (_, g) => (
<ul
key={g}
className='cf-twl__group'
aria-hidden={g > 0 ? true : undefined}
aria-labelledby={g === 0 ? tapeId : undefined}
>
{enclosures.map((item, i) => (
<li key={i} className='cf-twl__item'>
{item.image ? (
<img src={item.image} alt={g > 0 ? '' : item.imageAlt ?? ''} width={40} height={40} decoding='async' />
) : null}
<span>{item.name}</span>
</li>
))}
</ul>
))}
</div>
</div>
{pauseButton}
</div>
) : null}
</article>
</div>
)
}
export default TypewriterLetterHero
/** Layout effect in the browser, plain effect during server rendering. */
const useIsoLayoutEffect = typeof window !== 'undefined' ? React.useLayoutEffect : React.useEffect
/** Splits the headline around the emphasised phrase so the marker can wrap just that run. */
function splitPhrase(text: string, phrase?: string): { text: string; em: boolean }[] {
const at = phrase ? text.indexOf(phrase) : -1
if (!phrase || at < 0) return [{ text, em: false }]
return [
{ text: text.slice(0, at), em: false },
{ text: phrase, em: true },
{ text: text.slice(at + phrase.length), em: false },
].filter((s) => s.text.length > 0)
}
const CSS = `
.cf-twl{
/* Handwritten margin face (integral to the piece): a theme supplies it through --signature-face; otherwise the display face. */
--signature-font: var(--signature-face, var(--font-display));
/* Ink for the margin notes follows the surface it sits on; pages can set --margin-ink. */
--twl-note: var(--margin-ink, var(--ink, #1a2233));
/* Marker: the theme's --marker; the documented yellow marker default otherwise. */
--twl-marker: var(--marker, #fae37c);
--twl-shadow: var(--shadow, oklch(0.22 0.03 256));
container: twl / inline-size;
position: relative;
isolation: isolate;
box-sizing: border-box;
width: 100%;
max-width: 70rem;
margin-inline: auto;
padding-bottom: .75rem;
color: var(--ink, #1a2233);
font-family: var(--font-body);
}
.cf-twl *, .cf-twl *::before, .cf-twl *::after{ box-sizing: border-box; }
/* Offset under-sheet: a second page peeking out, carrying the same faint texture. */
.cf-twl__under{
position: absolute; inset: .75rem .5rem 0 .75rem; z-index: -1;
overflow: hidden; isolation: isolate;
border-radius: var(--card-radius, var(--radius, 14px));
background: color-mix(in oklch, var(--ink) 6%, var(--card));
border: 1px solid oklch(from var(--ink) l c h / .1);
box-shadow: inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .6), var(--shadow-sm, 0 1px 2px oklch(from var(--twl-shadow) l c h / .2));
transform: rotate(1.1deg);
}
.cf-twl__under::before,
.cf-twl__margin::before{
content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
background-image: var(--twl-texture, none);
background-size: 26rem auto; background-repeat: repeat; background-position: 0 0;
filter: grayscale(1) contrast(1.15);
mix-blend-mode: multiply;
opacity: .4;
}
.cf-twl[data-textured='false'] .cf-twl__under::before,
.cf-twl[data-textured='false'] .cf-twl__margin::before{ display: none; }
.cf-twl__sheet{
--twl-margin: clamp(12rem, 22cqi, 15rem);
--twl-pl: clamp(2rem, 4.2cqi, 3.5rem);
--twl-hsize: clamp(2.25rem, 0.8rem + 4.2cqi, 3.75rem);
position: relative;
display: grid;
grid-template-columns: var(--twl-margin) minmax(0, 1fr);
grid-template-areas: 'margin letter' 'tape tape';
overflow: clip;
background: var(--card, #ffffff);
border: 1px solid var(--card-border, color-mix(in oklch, var(--ink) 12%, transparent));
border-radius: var(--card-radius, var(--radius, 14px));
box-shadow:
inset 0 1px 0 oklch(from var(--card) calc(l + 0.04) c h / .6),
inset 0 -1px 0 oklch(from var(--ink) l c h / .05),
var(--card-shadow, var(--shadow-lg, 0 2px 4px oklch(from var(--twl-shadow) l c h / .22), 0 12px 24px -8px oklch(from var(--twl-shadow) l c h / .32)));
}
/* Margin gutter: quiet grey well, faint paper grain, and a soft inset fold shade toward the letter. */
.cf-twl__margin{
grid-area: margin;
position: relative; isolation: isolate;
background: color-mix(in oklch, var(--ink) 4%, var(--card));
border-right: 1px solid oklch(from var(--ink) l c h / .08);
box-shadow:
inset -14px 0 18px -16px oklch(from var(--twl-shadow) l c h / .3),
inset 0 12px 16px -16px oklch(from var(--twl-shadow) l c h / .18),
inset 1px 0 0 oklch(from var(--card) calc(l + 0.04) c h / .5);
}
.cf-twl__letter{
grid-area: letter; min-width: 0;
padding: clamp(2.25rem, 4cqi, 3.25rem) clamp(1.5rem, 4cqi, 3.5rem) clamp(2rem, 3.5cqi, 2.75rem) var(--twl-pl);
}
.cf-twl__salute{ margin: 0 0 .9rem; font-family: var(--font-display); font-weight: var(--display-weight, 700); font-size: 1.375rem; line-height: 1.25; color: var(--ink); }
.cf-twl__hook{ position: relative; }
.cf-twl__h{
margin: 0; color: var(--ink);
font-family: var(--font-display); font-weight: var(--display-weight, 800);
font-size: var(--twl-hsize); line-height: 1.04;
letter-spacing: var(--display-tracking, -0.022em); text-transform: var(--display-case, none);
text-wrap: balance;
}
.cf-twl__sr{ position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.cf-twl__ghost{ color: color-mix(in oklch, var(--ink) 20%, var(--card)); }
.cf-twl__caret{ position: relative; }
.cf-twl__caret::after{ content: ''; position: absolute; left: .03em; bottom: -.02em; width: .075em; height: 1em; border-radius: 1px; background: currentColor; }
.cf-twl__em{
background-image: linear-gradient(var(--twl-marker), var(--twl-marker));
background-repeat: no-repeat; background-position: 0 86%; background-size: 100% .46em;
-webkit-box-decoration-break: clone; box-decoration-break: clone;
padding: 0 .1em; margin: 0 -.06em; border-radius: .2em .35em .25em .3em;
}
.cf-twl[data-motion='on'] .cf-twl__em:not(.is-on){ background-size: 0% .46em; }
.cf-twl[data-motion='on'] .cf-twl__em.is-on{ transition: background-size .6s cubic-bezier(.3,.7,.2,1) .05s; }
/* Margin notes sit centred in the gutter, level with what they annotate. */
.cf-twl__cue{ position: absolute; z-index: 1; width: calc(var(--twl-margin) - 2rem); right: calc(100% + var(--twl-pl) + 1rem); }
.cf-twl__cue--hook{ top: calc(var(--twl-hsize) * .95); }
.cf-twl__cue--act{ top: 50%; transform: translateY(-50%); }
.cf-twl__note{
margin: 0; color: var(--twl-note);
font-family: var(--signature-font); font-weight: var(--signature-weight, var(--display-weight, 700)); font-size: 1.75rem; line-height: 1;
text-align: center; text-wrap: balance; transform: rotate(-4deg);
}
.cf-twl__lead{
margin: 1.25rem 0 0; max-width: 40em; color: var(--ink);
font-size: clamp(1.125rem, 1rem + .5cqi, 1.375rem); font-weight: 500; line-height: 1.5; text-wrap: pretty;
}
.cf-twl__ps{ margin-top: clamp(1.75rem, 3cqi, 2.5rem); padding-top: 1.5rem; border-top: 1px solid oklch(from var(--ink) l c h / .14); }
.cf-twl__ask{
margin: 0 0 1rem; color: var(--ink);
font-family: var(--font-display); font-weight: var(--display-weight, 800); font-size: clamp(1.25rem, 1rem + 1cqi, 1.625rem); line-height: 1.2; text-wrap: balance;
}
.cf-twl__ps-tag{ margin-right: .2rem; }
.cf-twl__act{ position: relative; max-width: 40rem; }
.cf-twl__cta{
--twl-btn: var(--button-bg, var(--cta, #d4372c));
position: relative; isolation: isolate; overflow: hidden;
display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem;
width: 100%; min-height: 4.75rem; margin: 0; padding: 1rem 1.5rem 1.15rem;
border: 1px solid oklch(from var(--twl-btn) calc(l - 0.12) c h);
border-radius: var(--button-radius, var(--radius, 12px));
background: linear-gradient(oklch(from var(--twl-btn) calc(l + 0.04) c h), var(--button-bg-2, var(--cta-2, #b02a21)));
color: var(--button-ink, var(--cta-ink, #ffffff));
font-family: var(--button-font, var(--font-display));
text-transform: var(--button-case, none);
text-shadow: var(--button-text-shadow, none);
text-align: center; text-decoration: none; cursor: pointer;
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--twl-btn) calc(l + 0.14) c h / .7), inset 0 -3px 0 oklch(from var(--twl-btn) calc(l - 0.16) c h), 0 1px 2px oklch(from var(--twl-shadow) l c h / .3), 0 8px 16px -6px oklch(from var(--twl-shadow) l c h / .45));
transition: transform .14s cubic-bezier(.2,.8,.2,1), box-shadow .14s ease, background .14s ease;
-webkit-tap-highlight-color: transparent;
}
.cf-twl__cta-label, .cf-twl__cta-sub{ position: relative; z-index: 1; }
.cf-twl__cta-label{ font-weight: var(--button-weight, 800); font-size: clamp(1.2rem, 1rem + 1.1cqi, 1.625rem); line-height: 1.12; letter-spacing: -.01em; text-wrap: balance; }
.cf-twl__cta-sub{ font-family: var(--font-body); font-weight: 600; font-size: .95rem; line-height: 1.3; text-wrap: balance; }
.cf-twl__cta::after{
content: ''; position: absolute; inset: -2px; z-index: 0; pointer-events: none;
background: linear-gradient(100deg, transparent 32%, oklch(from var(--twl-btn) calc(l + 0.2) c h / .45) 50%, transparent 68%);
transform: translateX(-140%);
}
.cf-twl[data-state='hover'] .cf-twl__cta:not(:disabled), .cf-twl__cta:not(:disabled):hover{
background: linear-gradient(oklch(from var(--twl-btn) calc(l + 0.08) c h), oklch(from var(--button-bg-2, var(--cta-2, #b02a21)) calc(l + 0.03) c h));
transform: translateY(-1px);
box-shadow: var(--button-shadow, inset 0 1px 0 oklch(from var(--twl-btn) calc(l + 0.16) c h / .7), inset 0 -3px 0 oklch(from var(--twl-btn) calc(l - 0.16) c h), 0 2px 3px oklch(from var(--twl-shadow) l c h / .32), 0 12px 20px -8px oklch(from var(--twl-shadow) l c h / .5));
}
.cf-twl[data-state='active'] .cf-twl__cta:not(:disabled), .cf-twl__cta:not(:disabled):active{
background: linear-gradient(oklch(from var(--twl-btn) calc(l - 0.02) c h), oklch(from var(--button-bg-2, var(--cta-2, #b02a21)) calc(l - 0.04) c h));
transform: translateY(1px);
box-shadow: inset 0 1px 0 oklch(from var(--twl-btn) calc(l + 0.08) c h / .5), inset 0 -1px 0 oklch(from var(--twl-btn) calc(l - 0.16) c h), 0 1px 1px oklch(from var(--twl-shadow) l c h / .3);
}
.cf-twl__cta:focus-visible{ outline: 3px solid var(--field-focus, var(--accent)); outline-offset: 3px; }
.cf-twl__cta:disabled{
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
border-color: oklch(from var(--secondary) calc(l - 0.08) c h);
text-shadow: none; cursor: not-allowed; transform: none;
box-shadow: var(--button-2-shadow, var(--shadow-sm));
}
.cf-twl__cta:disabled::after{ display: none; }
.cf-twl__assure{
display: flex; flex-wrap: wrap; justify-content: center; gap: .4rem 1.1rem;
max-width: 40rem; margin: .9rem 0 0; padding: 0; list-style: none;
}
.cf-twl__assure li{ display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); font-size: .9375rem; font-weight: 500; line-height: 1.35; }
.cf-twl__assure svg{ flex: none; color: var(--success); }
.cf-twl__tape{
grid-area: tape; min-width: 0;
display: flex; align-items: center; gap: .75rem 1rem;
padding: .7rem 1rem .7rem var(--twl-pl);
background: color-mix(in oklch, var(--ink) 4%, var(--card));
box-shadow: inset 0 10px 14px -14px oklch(from var(--twl-shadow) l c h / .22);
}
.cf-twl__tape-label{ flex: none; color: var(--ink); font-family: var(--font-display); font-weight: var(--display-weight, 800); font-size: .9375rem; }
.cf-twl__viewport{
flex: 1 1 auto; min-width: 0; overflow: hidden;
/* Mask is alpha only: currentColor is opaque, so only its alpha is read, never shown. */
-webkit-mask-image: linear-gradient(90deg, transparent, currentColor 2rem, currentColor calc(100% - 2rem), transparent);
mask-image: linear-gradient(90deg, transparent, currentColor 2rem, currentColor calc(100% - 2rem), transparent);
}
.cf-twl__track{ display: flex; width: max-content; }
.cf-twl__group{ display: flex; flex: none; align-items: center; margin: 0; padding: 0; list-style: none; }
.cf-twl__item{ display: flex; align-items: center; gap: .6rem; padding: .15rem 2.25rem .15rem 0; white-space: nowrap; color: var(--ink); font-size: .9375rem; font-weight: 700; }
.cf-twl__item img{ width: 2.5rem; height: 2.5rem; object-fit: cover; border-radius: .45rem; filter: drop-shadow(0 1px 1.5px oklch(from var(--twl-shadow) l c h / .3)); }
.cf-twl__pause{
flex: none; display: inline-flex; align-items: center; justify-content: center;
width: 2.75rem; height: 2.75rem; padding: 0; border-radius: 999px; cursor: pointer;
border: 1px solid var(--button-2-border, transparent);
background: var(--button-2-bg, var(--secondary));
color: var(--button-2-ink, var(--secondary-ink));
box-shadow: var(--button-2-shadow, var(--shadow-sm));
transition: background .14s ease;
}
.cf-twl__pause:hover{ background: oklch(from var(--button-2-bg, var(--secondary)) calc(l - 0.04) c h); }
.cf-twl__pause:focus-visible{ outline: 3px solid var(--field-focus, var(--accent)); outline-offset: 2px; }
.cf-twl__pause--inline{ display: flex; margin: .75rem auto 0; }
.cf-twl[data-motion='on'][data-done='false'] .cf-twl__note{ clip-path: inset(-20% 104% -20% -4%); }
@media (prefers-reduced-motion: no-preference){
.cf-twl[data-motion='on'][data-done='true'] .cf-twl__note{ transition: clip-path .8s cubic-bezier(.55,.1,.35,1) .1s; }
.cf-twl[data-motion='on'][data-done='true'] .cf-twl__cue--act .cf-twl__note{ transition-delay: .9s; }
.cf-twl[data-done='true'] .cf-twl__caret::after{ animation: twl-blink 1.05s steps(1) infinite; }
.cf-twl__cta:not(:disabled)::after{ animation: twl-sheen 6.5s ease-in-out 2.6s infinite; }
.cf-twl__track{ animation: twl-tape 34s linear infinite; }
.cf-twl__tape:hover .cf-twl__track, .cf-twl__tape:focus-within .cf-twl__track{ animation-play-state: paused; }
.cf-twl[data-paused='true'] .cf-twl__track,
.cf-twl[data-paused='true'] .cf-twl__caret::after,
.cf-twl[data-paused='true'] .cf-twl__cta::after{ animation-play-state: paused; }
}
@media (prefers-reduced-motion: reduce){
.cf-twl__caret{ display: none; }
.cf-twl__group[aria-hidden='true']{ display: none; }
/* Static enclosures: one list that wraps inside the tape instead of running past the edge. */
.cf-twl__track{ width: 100%; min-width: 0; }
.cf-twl__group{ flex: 1 1 auto; min-width: 0; flex-wrap: wrap; row-gap: .5rem; }
.cf-twl__item{ min-width: 0; white-space: normal; }
.cf-twl__viewport{ -webkit-mask-image: none; mask-image: none; }
.cf-twl__cta, .cf-twl__pause{ transition: none; }
.cf-twl[data-state='hover'] .cf-twl__cta:not(:disabled), .cf-twl__cta:not(:disabled):hover, .cf-twl__cta:not(:disabled):active{ transform: none; }
}
@keyframes twl-blink{ 0%, 55%{ opacity: 1; } 56%, 100%{ opacity: 0; } }
@keyframes twl-sheen{ 0%{ transform: translateX(-140%); } 22%, 100%{ transform: translateX(140%); } }
@keyframes twl-tape{ to{ transform: translateX(-25%); } }
@container twl (max-width: 46rem){
.cf-twl__under{ transform: none; inset: .6rem .4rem 0 .4rem; }
.cf-twl__sheet{ grid-template-columns: minmax(0, 1fr); grid-template-areas: 'letter' 'tape'; }
.cf-twl__margin{ display: none; }
.cf-twl__letter{ padding: 1.5rem 1.25rem; }
.cf-twl__salute{ margin-bottom: 1rem; }
.cf-twl__cue{ position: static; width: auto; transform: none; }
.cf-twl__cue--hook{ margin-top: .85rem; }
.cf-twl__cue--hook .cf-twl__note{ text-align: left; transform: rotate(-2deg); transform-origin: 0 50%; }
.cf-twl__cue--act{ margin: 0 auto .6rem; }
.cf-twl__cue--act .cf-twl__note{ transform: rotate(-2deg); }
.cf-twl__note{ font-size: 1.5rem; }
.cf-twl__cta{ padding: 1rem 1rem 1.1rem; }
.cf-twl__tape{ padding: .6rem .75rem; gap: .6rem; }
}
`
pieces/attention/typewriter-letter-hero/specimen.tsx 29 lines
import __studioImage75a00d77 from "../assets/ace9243c4dcf3ab4.webp";
import * as React from 'react'
import { TypewriterLetterHero, type TypewriterLetterHeroProps } from '../typewriter-letter-hero'
import defaults from '../../studio-defaults.json'
import { slot } from '../../slots'
export const states = ['default', 'hover', 'active', 'disabled'] as const
type SpecimenState = NonNullable<TypewriterLetterHeroProps['state']>
export default function TypewriterLetterHeroSpecimen({ state = 'default' }: { state?: SpecimenState }) {
const sample = defaults.sample
return (
<TypewriterLetterHero
state={state}
headline={sample.headline}
emphasis='a clear plan'
lead={sample.lead}
actionSubline={`${sample.name} · ${sample.price}`}
reassurance={sample.reassurance}
textureImage={slot('texture', __studioImage75a00d77)}
enclosures={sample.items.map((item, index) => ({
name: item.name,
image: slot(`item-${index + 1}`, item.image),
imageAlt: item.imageAlt,
}))}
/>
)
}
| Name | Type | Details |
|---|---|---|
salutation OptionalTypewriterLetterHero |
string |
|
headline OptionalTypewriterLetterHero |
string |
|
emphasis OptionalTypewriterLetterHero |
string |
|
headingLevel OptionalTypewriterLetterHero |
'h1' | 'h2' |
|
lead OptionalTypewriterLetterHero |
React.ReactNode |
|
hookNote OptionalTypewriterLetterHero |
string |
|
psLabel OptionalTypewriterLetterHero |
string |
|
question OptionalTypewriterLetterHero |
string |
|
actionLabel OptionalTypewriterLetterHero |
string |
|
actionSubline OptionalTypewriterLetterHero |
string |
|
actionNote OptionalTypewriterLetterHero |
string |
|
reassurance OptionalTypewriterLetterHero |
string[] |
|
textureImage OptionalTypewriterLetterHero |
string |
|
enclosuresLabel OptionalTypewriterLetterHero |
string |
|
enclosures OptionalTypewriterLetterHero |
TypewriterLetterHeroItem[] |
|
pauseLabel OptionalTypewriterLetterHero |
string |
|
playLabel OptionalTypewriterLetterHero |
string |
|
href OptionalTypewriterLetterHero |
string |
|
onAction OptionalTypewriterLetterHero |
(event: React.MouseEvent<HTMLAnchorElement | HTMLButtonElement>) => void |
|
disabled OptionalTypewriterLetterHero |
boolean |
|
state OptionalTypewriterLetterHero |
'default' | 'hover' | 'active' | 'disabled' |
|
className OptionalTypewriterLetterHero |
string |
Theme roles it reads
Set by the theme bar, a preset or your brand. Colours come from the base tokens (--surface, --ink, --cta…) every piece uses.
--button-bg--button-bg-2--button-case--button-font--button-ink--button-radius--button-shadow--button-text-shadow--button-weight- Main CTA button: background, ink, font, weight, case, radius and shadow.
--button-2-bg--button-2-border--button-2-ink--button-2-shadow- Secondary button.
--card-border--card-radius--card-shadow- Cards and panels: radius, border and shadow.
--display-case--display-tracking--display-weight- Headlines: weight, letter case and tracking.
--field-focus- Form inputs: background, ink, border, radius and focus colour.
--marker- The highlighter colour behind key phrases.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
item-*- One image per offer item (item-1, item-2…), shown in stacks and lists.
texture- A subtle background texture.
-
ace9243c4dcf3ab4.webp
image/webp · 106 KB
-
b77916eca54aa689.webp
image/webp · 8.32 KB
-
d435db6662febfcf.webp
image/webp · 10 KB
-
f0a5d3e1e61804ba.webp
image/webp · 11.6 KB