Link unfurl
NewA sent invite link unfolded into a black video card, where a fox drawn in white scanlines peeks in and waves.
link-unfurl/link-unfurl.tsxToday 11:00 AM
The live component, numbered part by part. Every measurement is read from it as it is drawn. Point at a row to outline its part, or at a part to find its row.
The choices it offers, each value drawn live and the default marked, with how to pick one.
When to use
- A link sent in a conversation that deserves more than its address: an invite, a release, a shared page with a picture of its own.
- Referral and invite links, where a moving preview in the thread is what gets the tap: the page’s
og:videoplayed as a short loop. - Any chat or feed that unfurls links as they are sent: a shimmer while the preview loads, then the card.
When not to use
- A link inside running text, a list of results or a table. Show the title as a plain link; a card per link drowns the words.
- Pages without a picture or a title of their own. Show the address alone rather than an empty card.
- Several moving previews on one screen. Let one play and keep the others on their still frame.
- Anything the reader must act on without opening it (a code to copy, a date to accept). Put that in the message itself.
Unfurling
- At once: the card appears the moment the link is sent, with its domain, so the thread never jumps from a bare address to a card.
- A shimmer, not a spinner, where the picture will be, and a bar where the title will be. Here it unfurls after 1.1 s (
unfurlDelay). - Words that aren’t a link go as a plain bubble. A link to the invite’s own site unfurls into the fox; any other into its letter.
The loop
- Short and quiet: 4.2 s, the fox leaning in by 7 units, reaching out from 1.05 to 1.5 s and waving until 3.2 s. The end meets the start, so it never jumps.
- Only while it can be seen: off screen, in a hidden tab or paused, the canvas stops drawing and holds its frame.
- Reduced motion starts it paused on the still frame; the play button still plays it on request.
Each one drawn with the component itself, used well or badly.
The words are the page’s title and domain, the time and the receipt, and the composer’s placeholder.
- The title is the page’s own (
og:title), in sentence or title case as the site writes it. An invite says what to join and the code:Join Hollowfox · Invite code: K7QD. - The domain, not the address:
invite.hollowfox.app, without https:// or the path, so the reader sees where the link goes. - Receipts in two words:
Delivered, thenRead 11:01 AM. - No full stops in the caption or the receipt.
You can add this component with the shadcn CLI or by hand:
Into components/link-unfurl of any React project, with no setup:
npx shadcn@latest add https://brunodelorence.com/r/link-unfurl.json- Copy the component files
Copy these files into one folder of your project, keeping their relative imports together, or download them as a ZIP:
- Import it
As shown under Usage, below.
Either way it needs React 19.2 and a bundler that supports CSS Modules, such as Next.js or Vite. It has a dark colour scheme: it follows your page’s color-scheme, light unless the page sets one, or its colorScheme prop, with nothing to configure. Browsers without light-dark() show it light.
Usage
import { LinkUnfurl } from './link-unfurl';export function InviteThread() { return ( <LinkUnfurl app="Hollowfox" code="K7QD" domain="invite.hollowfox.app" onOpen={(href) => window.open(href, '_blank', 'noopener')} onSend={(text) => console.log('sent', text)} autoplay={false} /> );}Each state below is a live instance, locked so you can study it.
The pieces it is built from, each with its measurements read live.
A message thread whose sent link has become a rich preview: a black video card where a fox engraved in horizontal white stripes leans in from the right edge, smiles, reaches out and waves on a 4.2 s loop, over a caption with the invite’s title and domain. The card opens like a link and lifts on hover; a button on the video pauses the loop. Type a link in the composer and send it, and a new card appears at once with a shimmer, then unfurls.
- The video is drawn, not played: the fox is painted in greys on a hidden canvas the size of the card, then redrawn on the visible one as white horizontal stripes 5.75 units apart, each as thick as the picture is light there, up to 64% of the spacing. Shading turns into thinner lines, and the eyes, nose and open mouth into gaps.
- A stripe starts where the picture passes about a quarter of full light, its edge smoothed over three samples, and each end is a half circle as tall as the stripe there, so the lines taper and round off like ink.
- The loop is timed on a 4.2 s reference: the fox leans in by 7 units in 0.25 s, opens its mouth by 0.6 s, swings an arm out from 1.05 to 1.5 s with a small overshoot, waves it until 3.2 s, blinks, and leans back out from 3.9 s, so the end meets the start.
- The canvas only draws while the card plays, is on screen (an IntersectionObserver) and the tab is visible; paused, it holds its frame and picks the loop up where it stopped. Under reduced motion it starts paused on a still frame, mid-wave.
- The card is 350 × 226 px, corners 18: the 1.91 : 1 video over a 43 px caption (title 15 px semibold, domain 13 px), with a tail curling out of its lower right corner. Hovering lifts it 2 px in 180 ms with a soft shadow; the caption is its button, stretched over the whole card.
- Sending a link adds its card at once, with the domain and a band of light crossing the black every 1.3 s; it unfurls 1.1 s later, the picture fading in over 350 ms. A link to the invite’s own site unfurls into the fox, any other into a shaded ball with the site’s letter cut out of it.
- While on screen and untouched, a demo pointer hovers the card, pauses and plays it, types a link, sends it and watches it unfurl, then clears the thread and starts over; any input from the reader stops it.
- Every colour is a token on the root, light-dark() where the two schemes differ: the chat follows the scheme, and the video stays black in both.
| Prop | Type | Default | Description |
|---|---|---|---|
app | string | 'Hollowfox' | The app the invite is for: the card reads “Join <app> · Invite code: <code>”. |
code | string | 'K7QD' | The invite code on the card. |
domain | string | 'invite.hollowfox.app' | The invite’s domain, under the title. Links sent to this site unfurl into the fox. |
onOpen | (href: string) => void | — | Called with a card’s address when the reader opens it. |
onSend | (text: string) => void | — | Called with what the reader sends from the composer. |
defaultPaused | boolean | false | Starts with the invite’s video paused on its still frame. |
defaultDraft | string | '' | Words already in the composer. |
defaultSent | (string | { text: string; loading: true })[] | [] | Messages already sent after the invite: links become cards, other words bubbles; one with loading stays unfurling. |
unfurlDelay | number | 1100 | How long a sent link shimmers before it unfurls, in ms. |
autoplay | boolean | true | While on screen and untouched, a demo pointer plays with the card and sends a link; any input from the reader stops it. |
colorScheme | 'light' | 'dark' | 'system' | — | Light or dark colours, or the reader’s; without it, the page’s color-scheme. |
className | string | — | A class for the thread’s frame. |
Keyboard
- Tab reaches each card’s button (Enter or Space opens it), then its play button, then the composer’s buttons and field.
- Enter in the field sends; Send appears in the tab order only when there is something to send.
- Every control shows a focus ring; the card’s goes round the whole card.
Screen readers
- The thread is a
lognamed Messages, so new messages are read as they arrive. - The card’s button is named by the title and the domain (“Join Hollowfox · Invite code: K7QD, invite.hollowfox.app”); while it loads, “Loading preview” and the domain.
- The play button says what it will do (“Pause preview”, “Play preview”), and a polite live region confirms it and “Opening …”. The canvas and the icons are hidden.
Motion
The loop is under 5 s, can be paused at any time (WCAG 2.2.2), stops off screen, and starts paused under reduced motion. The shimmer and the lift are dropped too.
Colour and contrast
The caption’s white title and grey domain are at least 6 : 1 on its dark grey in both schemes; the time and the receipt are over 4.5 : 1 on the chat’s background.
In this build
- The thread is a log named Messages, so new messages are read as they arrive.
- Each card is a button named by its title and domain, with its hit area over the whole card and a focus ring round it; while it loads it says “Loading preview” and the domain.
- The play button on the video says what it will do (Pause preview, Play preview); a polite live region confirms it, and “Opening …” when a card is opened.
- The loop is under 5 s, can be paused at any time, stops off screen and starts paused under reduced motion, which also drops the shimmer, the lift and the rise of new messages.
- The composer’s buttons are named (Add the invite link, Add a wave, Send); Enter in the field sends. The canvas, the icons and the demo pointer are hidden from screen readers.
The complete source behind this demo. Open source under the MIT license, © 2026 Bruno Delorence: copy it, change it, ship it.
// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useEffectEvent, useRef, useState, type FormEvent } from 'react';import { DemoPointer, runDemo, type Point } from './demo-pointer';import { Chevron, Pause, Play, Plus, Send, Smile, Tail, Voice } from './glyphs';import { ScanlineVideo } from './scanline-video';import type { Scene } from './scanline';import { useAutoplay } from './use-autoplay';import styles from './link-unfurl.module.css';/* * Link unfurl: a message thread whose sent link has unfolded into a rich preview, a black video * card where a fox drawn in white scanlines peeks in from the right edge and waves, on a loop, * over a caption bar with the page's title and domain. * * - The card is one control: a button that opens the link, with its hit area stretched over the * whole card. Hovering lifts it 2 px; its focus ring goes round the card. A play/pause button * sits on the video, over that hit area. * - The video is drawn on a canvas (scanline.ts), so it plays only while it should: on screen, * the tab visible, not paused. Under reduced motion it starts paused on a still frame, and the * play button still plays it on request. * - Type a link in the composer and send it: a card appears at once with a shimmer where the/* Link unfurl (link-unfurl.tsx): a message thread, a sent link unfolded into a rich preview, and the composer under it. Sizes are the reference's, in css px: the card is 350 wide (or the thread's width, less its gutters, when narrower), its video 350 × 183 (1.91 : 1, a link preview's image) over a 43 px caption bar, corners 18. The caption's title is 15 px semibold, the domain 13 px; the time and the receipt 11 px. The composer's round buttons and its field are 32 px tall. Colours are the tokens below, light-dark(light, dark) where the two differ: the chat follows the color-scheme it inherits from the page, or the one its colorScheme prop sets. The video is black in both, as a video is. */.root { --chat: #fafafa; --ink: #1c1c1e; --muted: #6c6c70; --edge: #e3e3e6; --field: #f6f6f7; --button: #fff; --caption: #1e1e1e; --caption-ink: #f3f3f3; --caption-muted: #a3a3a8; --skeleton: #3b3b3e; --lift: rgb(0 0 0 / 0.16);// Copyright (c) 2026 Bruno Delorence. MIT License./* * The preview's "video": a picture drawn in greys on a hidden canvas, then redrawn on the visible * one as white horizontal stripes on black, like a 1-bit engraving. Each stripe runs along one * row of the grey picture; how thick it is at each point is how light the picture is there, so * shading turns into thinner lines and the darkest parts (eyes, nose, the mouth) into gaps. * * - The design space is the reference's card: 350 × 183 units (the 1.91 : 1 of a link preview's * image), scaled to the canvas's width. Stripes are 5.75 units apart and at most 64% of that * thick, as measured on the reference. * - A stripe starts where the picture is lighter than about a quarter, and each end is a half * circle as tall as the stripe there, so the lines taper and round off like ink. * - Two scenes: the fox, peeking in from the right edge and waving on a 4.2 s loop, and a shaded * ball with a letter cut out of it, for links the thread knows nothing about. */export type Scene = { kind: 'fox' } | { kind: 'letter'; letter: string };/** One loop of the scene, in ms (the reference clip is 4.2 s). */export const LOOP = 4200;/** Where a still frame stands in the loop, in s: the arm up, mid-wave, the mouth open. */export const STILL = 2.05;// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useEffect, useRef } from 'react';import { createRenderer, LOOP, STILL, type Scene } from './scanline';/* * The preview's moving picture, drawn frame by frame on a canvas (scanline.ts). It only runs * while it should play, is on screen and the tab is visible; otherwise it holds its frame, and * picks up the loop where it stopped. Never playing at all (reduced motion, or paused from the * start), it shows the still frame: the fox mid-wave. */export function ScanlineVideo({ scene, playing, className,}: { scene: Scene; playing: boolean; className?: string;}) { const canvas = useRef<HTMLCanvasElement>(null); /** ms into the loop, kept across pauses. */// Copyright (c) 2026 Bruno Delorence. MIT License./* * The thread's icons, drawn on a 24-unit grid in currentColor, all hidden from screen readers: * the buttons that hold them carry the names. */type GlyphProps = { className?: string };const svg = { viewBox: '0 0 24 24', 'aria-hidden': true, focusable: false,} as const;export function Plus({ className }: GlyphProps) { return ( <svg {...svg} className={className}> <path d="M12 4.5v15M4.5 12h15" stroke="currentColor" strokeWidth="2" strokeLinecap="round" /> </svg> );}/** Five bars of a voice level, as the composer shows while it's empty. */// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import type { CSSProperties, Ref } from 'react';/* * The demo's pointer, and the steps that move it. A demo is a script of awaited steps: wait, or * glide the pointer somewhere. Stopping the demo (the reader takes over, or it scrolls away) ends * the step in progress at once: its promise rejects, which ends the script right there, and the * pointer fades out. * * Each glide is a curved flight played by the Web Animations API, so nothing runs frame by frame. * The points of the flight are handed to whoever wants to move along with it (nothing here uses * them yet). The arrow and the hand are HTML boxes * that swap by their visibility: a change of style inside an SVG would lay the SVG out again. */export type Point = { x: number; y: number };/** A glide's path and timing, for an animation that plays along with it. */export type Flight = { points: Point[]; timing: KeyframeAnimationOptions };export type Demo = {// Copyright (c) 2026 Bruno Delorence. MIT License.'use client';import { useCallback, useEffect, useRef, useState } from 'react';/* * When a demo may play on its own: while part of it is on screen and the tab is visible, never * under reduced motion, and never again once the reader has used it: `take()` hands it to the * reader for good (until the component mounts again), so it can't come back on its own. */export function useAutoplay<T extends HTMLElement>() { const ref = useRef<T>(null); const [visible, setVisible] = useState(false); const [reduced, setReduced] = useState(true); const [taken, setTaken] = useState(false); useEffect(() => { const element = ref.current; if (!element) return; let onScreen = false; const update = () => setVisible(onScreen && !document.hidden); const observer = new IntersectionObserver( ([entry]) => {