Image In Type 1
Image in type: one or two giant words filled with a photo that pans slowly as the reader scrolls, so the idea stops the scroll.
Use it in a prompt
Use content/image-in-type 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/content/image-in-type.tsx. - Import it and pass your copy and images (Props tab):
import { ImageInType } from "@/components/funneldna/content/image-in-type"
It restyles from the theme tokens on any wrapper (Theme tab). The specimen source is a complete working example.
pieces/content/image-in-type/component.tsx 304 lines
// layout: photo-overlap-card
// Image in type: one or two giant words filled with a photo that pans slowly as the reader scrolls, so the idea stops the scroll.
// A sentence card breaks the band's lower edge and carries that idea down into the page. There is no button; the type is the design.
import * as React from "react";
import { Spotlight, Divider, FX_HOST } from "../fx/fx";
export type ImageInTypeProps = {
/** One or two giant words. A space starts a second line, and each line is fitted to the section width. */
word?: string;
/** The one sentence under the word that completes the idea. */
sentence?: React.ReactNode;
/** Optional italic aside in the author's voice, set after the sentence. */
aside?: React.ReactNode;
/** "scene" slot: the photo inside the letters. If it is missing or fails to load, the letters are solid ink. */
sceneImage?: string;
/** Focal point of the photo, as a CSS background-position (used as-is when still; x is kept while panning). */
imagePosition?: string;
/** band = dark stage with spotlight; light = quiet grey band. */
tone?: "band" | "light";
/** Hover and focus make the letter strokes widen briefly. */
interactive?: boolean;
state?: "default" | "hover" | "active" | "disabled" | "error";
className?: string;
};
const useIsoLayoutEffect = typeof window !== "undefined" ? React.useLayoutEffect : React.useEffect;
export function ImageInType(props: ImageInTypeProps) {
const {
word = "Picture it",
sentence = "Hold that picture. Everything below shows you how to get there.",
aside,
sceneImage,
imagePosition = "50% 50%",
tone = "band",
interactive = true,
state = "default",
className,
} = props;
const lines = React.useMemo(() => splitLines(word || ""), [word]);
const stageRef = React.useRef<HTMLDivElement>(null);
const headRef = React.useRef<HTMLHeadingElement>(null);
const [loaded, setLoaded] = React.useState(false);
const [failed, setFailed] = React.useState(false);
const [supportsClip, setSupportsClip] = React.useState(true);
const [reduce, setReduce] = React.useState<boolean>(() =>
typeof window !== "undefined" && typeof window.matchMedia === "function"
? window.matchMedia("(prefers-reduced-motion: reduce)").matches
: false
);
// Motion preference
React.useEffect(() => {
if (typeof window.matchMedia !== "function") return;
const mq = window.matchMedia("(prefers-reduced-motion: reduce)");
const on = () => setReduce(mq.matches);
on();
mq.addEventListener?.("change", on);
return () => mq.removeEventListener?.("change", on);
}, []);
// Feature check: background-clip:text (window.CSS, not the style string)
React.useEffect(() => {
const api = typeof window !== "undefined" ? window.CSS : undefined;
if (!api || typeof api.supports !== "function") return;
setSupportsClip(api.supports("background-clip", "text") || api.supports("-webkit-background-clip", "text"));
}, []);
// Preload the photo; letters stay solid ink until it loads and if it fails
React.useEffect(() => {
setLoaded(false);
setFailed(false);
if (!sceneImage) return;
let live = true;
const img = new Image();
img.onload = () => live && setLoaded(true);
img.onerror = () => live && setFailed(true);
img.src = sceneImage;
if (img.complete && img.naturalWidth > 0) setLoaded(true);
return () => {
live = false;
img.onload = null;
img.onerror = null;
};
}, [sceneImage]);
const filled = !!sceneImage && loaded && !failed && supportsClip && state !== "error";
const panning = filled && !reduce;
const live = interactive && state !== "disabled";
// Fit routine: each line is sized so the word fills the section width
const fit = React.useCallback(() => {
const stage = stageRef.current;
if (!stage) return;
const avail = stage.clientWidth;
if (!avail) return;
const els = Array.from(stage.querySelectorAll<HTMLElement>(".cf-iit__word .cf-iit__line"));
const ghosts = Array.from(stage.querySelectorAll<HTMLElement>(".cf-iit__ghost .cf-iit__line"));
if (!els.length) return;
els.forEach((el) => {
el.style.setProperty("--fit", "100px");
el.style.whiteSpace = "nowrap";
el.style.maxInlineSize = "none";
});
const widths = els.map((el) => el.getBoundingClientRect().width);
const raw = widths.map((w) => (w > 0 ? (100 * avail * 0.96) / w : 0));
const valid = raw.filter((n) => n > 0);
const smallest = valid.length ? Math.min(...valid) : 0;
els.forEach((el, i) => {
el.style.whiteSpace = "";
el.style.maxInlineSize = "";
const ghost = ghosts[i];
if (!raw[i]) {
el.style.removeProperty("--fit");
ghost?.style.removeProperty("--fit");
return;
}
const size = Math.max(20, Math.min(raw[i], 560, avail * 0.5, smallest * 1.8));
el.style.setProperty("--fit", size.toFixed(2) + "px");
ghost?.style.setProperty("--fit", size.toFixed(2) + "px");
});
}, []);
useIsoLayoutEffect(() => {
const stage = stageRef.current;
if (!stage) return;
fit();
let lastW = stage.clientWidth;
const ro = typeof ResizeObserver !== "undefined"
? new ResizeObserver(() => {
const w = stage.clientWidth;
if (w !== lastW) {
lastW = w;
fit();
}
})
: null;
ro?.observe(stage);
const fonts = (document as Document & { fonts?: FontFaceSet }).fonts;
let alive = true;
fonts?.ready.then(() => alive && fit());
fonts?.addEventListener?.("loadingdone", fit);
return () => {
alive = false;
ro?.disconnect();
fonts?.removeEventListener?.("loadingdone", fit);
};
}, [fit, word, filled]);
// Scroll pan: one rAF-throttled read while the word is on screen
React.useEffect(() => {
const el = headRef.current;
if (!el || !panning) return;
let raf = 0;
let onScreen = false;
const update = () => {
raf = 0;
const r = el.getBoundingClientRect();
const vh = window.innerHeight || 1;
const p = Math.min(1, Math.max(0, (vh - r.top) / (vh + r.height)));
el.style.setProperty("--pan", p.toFixed(4));
};
const request = () => {
if (onScreen && !raf) raf = requestAnimationFrame(update);
};
const io = typeof IntersectionObserver !== "undefined"
? new IntersectionObserver((entries) => {
onScreen = entries.some((e) => e.isIntersecting);
request();
})
: null;
if (io) io.observe(el);
else onScreen = true;
request();
window.addEventListener("scroll", request, { passive: true });
window.addEventListener("resize", request);
return () => {
io?.disconnect();
window.removeEventListener("scroll", request);
window.removeEventListener("resize", request);
if (raf) cancelAnimationFrame(raf);
el.style.removeProperty("--pan");
};
}, [panning]);
const hasCard = !!sentence || !!aside;
if (!lines.length && !hasCard) return null;
const posX = imagePosition.trim().split(/\s+/)[0] || "50%";
const wordStyle = {
"--iit-img": filled && sceneImage ? `url("${sceneImage.replace(/"/g, "%22")}")` : undefined,
"--iit-pos": imagePosition,
"--iit-px": posX,
} as React.CSSProperties;
const cls = [
"cf-iit",
tone === "light" ? "cf-iit--light" : "cf-iit--band",
filled ? "is-filled" : "",
panning ? "is-panning" : "",
live ? "is-live" : "is-disabled",
state === "hover" ? "is-hover" : "",
state === "active" ? "is-active" : "",
hasCard ? "" : "cf-iit--no-card",
className || "",
].filter(Boolean).join(" ");
return (
<section className={cls}>
<style>{STYLES}</style>
<div className="cf-iit__band" style={FX_HOST}>
{tone === "band" ? <Spotlight /> : null}
{lines.length ? (
<div className="cf-iit__inner">
<div className="cf-iit__stage" ref={stageRef}>
{filled ? (
<div className="cf-iit__type cf-iit__ghost" aria-hidden="true">
{lines.map((line, i) => (
<span key={i} className="cf-iit__line" style={{ "--chars": Math.max(line.length, 2) } as React.CSSProperties}>
<span className="cf-iit__glyphs">{line}</span>
</span>
))}
</div>
) : null}
<h2 ref={headRef} className="cf-iit__type cf-iit__word" style={wordStyle} tabIndex={live ? 0 : undefined}>
{lines.map((line, i) => (
<React.Fragment key={i}>
{i > 0 ? " " : null}
<span className="cf-iit__line" style={{ "--chars": Math.max(line.length, 2) } as React.CSSProperties}>
<span className="cf-iit__glyphs">{line}</span>
</span>
</React.Fragment>
))}
</h2>
<div className="cf-iit__floor" aria-hidden="true" />
</div>
</div>
) : null}
<div className="cf-iit__edge" aria-hidden="true">
<Divider shape="wave" tone="surface" height={56} />
</div>
</div>
{hasCard ? (
<div className="cf-iit__tail">
<div className="cf-iit__card">
{sentence ? <p className="cf-iit__sentence">{sentence}</p> : null}
{aside ? <p className="cf-iit__aside">{aside}</p> : null}
</div>
</div>
) : null}
</section>
);
}
export default ImageInType;
function splitLines(word: string): string[] {
const parts = word.trim().split(/\s+/).filter(Boolean);
if (parts.length <= 2) return parts;
const half = Math.ceil(parts.length / 2);
return [parts.slice(0, half).join(" "), parts.slice(half).join(" ")];
}
const STYLES = `
.cf-iit{position:relative;isolation:isolate;font-family:var(--font-body);background:var(--surface)}
.cf-iit *,.cf-iit *::before,.cf-iit *::after{box-sizing:border-box}
.cf-iit__band{position:relative;overflow:hidden;background:var(--band);color:var(--band-ink);padding:clamp(56px,8vw,112px) clamp(16px,5vw,48px) calc(clamp(24px,3vw,48px) + 56px + clamp(64px,8vw,104px))}
.cf-iit--no-card .cf-iit__band{padding-bottom:calc(clamp(64px,8.5vw,120px) + 56px)}
.cf-iit--light .cf-iit__band{background:color-mix(in oklch,var(--ink) 5%,var(--surface));color:var(--ink)}
.cf-iit__inner{position:relative;z-index:1;max-inline-size:1280px;margin-inline:auto;min-width:0}
.cf-iit__stage{position:relative;display:grid;container-type:inline-size;min-width:0;animation:cf-iit-rise .45s cubic-bezier(.2,.7,.2,1) backwards}
.cf-iit__type{grid-area:1/1;min-width:0;margin:0;padding-block:clamp(4px,1cqi,16px) clamp(10px,2.6cqi,40px);font-family:var(--font-display);font-weight:var(--display-weight,800);letter-spacing:max(var(--display-tracking,-0.025em),-0.03em);text-transform:var(--display-case,none);line-height:.94;text-align:center;text-shadow:none}
.cf-iit__ghost{color:color-mix(in oklch,var(--band-ink) 26%,var(--band));pointer-events:none;user-select:none}
.cf-iit--light .cf-iit__ghost{color:color-mix(in oklch,var(--ink) 24%,var(--surface))}
.cf-iit__word{--iit-tint:oklch(from var(--band-ink) l c h / .06);position:relative;z-index:1;color:inherit;border-radius:var(--radius,12px);outline:0 solid transparent;outline-offset:4px;cursor:default;-webkit-tap-highlight-color:transparent}
.cf-iit--light .cf-iit__word{--iit-tint:oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .16)}
.cf-iit.is-filled .cf-iit__word{color:transparent;-webkit-text-fill-color:transparent;background-image:linear-gradient(var(--iit-tint),var(--iit-tint)),var(--iit-img);background-repeat:no-repeat;background-size:cover,cover;background-position:center,var(--iit-pos,50% 50%);-webkit-background-clip:text;background-clip:text}
.cf-iit.is-panning .cf-iit__word{background-position:center,var(--iit-px,50%) calc(15% + var(--pan,.5) * 70%)}
.cf-iit__line{display:block;inline-size:fit-content;max-inline-size:100%;min-width:0;margin-inline:auto;font-size:var(--fit,clamp(1.75rem,calc(94cqi / (var(--chars) * .74)),32rem));overflow-wrap:anywhere;hyphens:auto}
.cf-iit__glyphs{-webkit-text-stroke-width:0;-webkit-text-stroke-color:currentColor}
.cf-iit.is-live .cf-iit__word:hover .cf-iit__glyphs,.cf-iit.is-live .cf-iit__word:focus-visible .cf-iit__glyphs{animation:cf-iit-flex 1.1s cubic-bezier(.2,.7,.2,1)}
.cf-iit.is-hover .cf-iit__glyphs{-webkit-text-stroke-width:.04em}
.cf-iit.is-live .cf-iit__word:active .cf-iit__glyphs,.cf-iit.is-active .cf-iit__glyphs{-webkit-text-stroke-width:.055em;animation:none;transition:-webkit-text-stroke-width .16s ease}
.cf-iit.is-live .cf-iit__word:focus-visible{outline:3px solid var(--band-ink)}
.cf-iit--light.is-live .cf-iit__word:focus-visible{outline-color:var(--field-focus,var(--accent))}
.cf-iit__floor{grid-row:2;inline-size:72%;block-size:clamp(14px,2.6cqi,40px);margin:calc(-1 * clamp(6px,1.4cqi,20px)) auto 0;background:radial-gradient(closest-side,oklch(from var(--shadow,oklch(0.22 0.03 260)) calc(l - .1) c h / .75),oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0));pointer-events:none}
.cf-iit--light .cf-iit__floor{background:radial-gradient(closest-side,oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / .32),oklch(from var(--shadow,oklch(0.22 0.03 260)) l c h / 0))}
.cf-iit__edge{position:absolute;inset-inline:0;bottom:0;block-size:56px;z-index:1;line-height:0;pointer-events:none}
.cf-iit__tail{position:relative;z-index:2;margin-top:calc(-1 * clamp(64px,8vw,104px));padding:0 clamp(16px,5vw,48px) clamp(56px,7vw,96px)}
.cf-iit__card{position:relative;max-inline-size:46rem;min-width:0;margin:0 auto;background:var(--card);color:var(--ink);border:1px solid var(--card-border,oklch(from var(--ink) l c h / .12));border-radius:var(--card-radius,var(--radius,14px));box-shadow:var(--card-shadow,var(--shadow-lg,0 2px 4px oklch(0.22 0.03 260 / .22),0 12px 24px -8px oklch(0.22 0.03 260 / .32)));padding:clamp(24px,3.4vw,40px) clamp(20px,3.4vw,44px);text-align:center;animation:cf-iit-rise .45s cubic-bezier(.2,.7,.2,1) .14s backwards}
.cf-iit__sentence{margin:0;font-size:clamp(1.3125rem,1.8vw,1.625rem);line-height:1.32;font-weight:600;letter-spacing:-0.01em;color:var(--ink);text-wrap:balance;overflow-wrap:anywhere}
.cf-iit__aside{margin:12px 0 0;font-size:clamp(1.0625rem,1.25vw,1.125rem);line-height:1.5;font-style:italic;font-weight:400;color:var(--muted);text-wrap:pretty;overflow-wrap:anywhere}
.cf-iit__sentence + .cf-iit__aside{margin-top:12px}
.cf-iit__card > .cf-iit__aside:first-child{margin-top:0}
@keyframes cf-iit-rise{from{opacity:.82;transform:translateY(8px)}}
@keyframes cf-iit-flex{0%{-webkit-text-stroke-width:0}40%{-webkit-text-stroke-width:.05em}100%{-webkit-text-stroke-width:0}}
@media (prefers-reduced-motion: reduce){
.cf-iit__stage,.cf-iit__card{animation:none}
.cf-iit.is-live .cf-iit__word:hover .cf-iit__glyphs,.cf-iit.is-live .cf-iit__word:focus-visible .cf-iit__glyphs{animation:none;-webkit-text-stroke-width:.03em}
.cf-iit.is-live .cf-iit__word:active .cf-iit__glyphs,.cf-iit.is-active .cf-iit__glyphs{animation:none;transition:none;-webkit-text-stroke-width:.055em}
.cf-iit.is-panning .cf-iit__word{background-position:center,var(--iit-pos,50% 50%)}
}
`;
pieces/content/image-in-type/specimen.tsx 22 lines
import __studioImage3fd9479e from "../assets/61a2b6651b853d27.webp";
import * as React from "react";
import { ImageInType, type ImageInTypeProps } from "../image-in-type";
import { slot } from "../../slots";
export const states = ["default", "hover", "active", "disabled", "error"];
export default function ImageInTypeSpecimen({ state }: { state?: ImageInTypeProps["state"] }) {
return (
<ImageInType
word="RIVERS"
sentence="run clear when the people who live beside them decide to keep them that way."
aside="(I know. You can almost hear it.)"
sceneImage={slot(
"scene",
__studioImage3fd9479e
)}
imagePosition="50% 60%"
state={state}
/>
);
}
| Name | Type | Details |
|---|---|---|
word OptionalImageInType |
string |
|
sentence OptionalImageInType |
React.ReactNode |
|
aside OptionalImageInType |
React.ReactNode |
|
sceneImage OptionalImageInType |
string |
|
imagePosition OptionalImageInType |
string |
|
tone OptionalImageInType |
"band" | "light" |
|
interactive OptionalImageInType |
boolean |
|
state OptionalImageInType |
"default" | "hover" | "active" | "disabled" | "error" |
|
className OptionalImageInType |
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.
--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.
Image slots
Filled from the brand’s images; the specimen ships its own defaults.
scene- A wide atmosphere photo behind or beside the copy.
-
61a2b6651b853d27.webp
image/webp · 229 KB