Share Image

The picture a link unfurls into on X, LinkedIn, Facebook, WhatsApp, iMessage and Slack: a kicker, the page's title, a line of description, and one optional piece of evidence (a big number, a few bars, or anything you draw), with your mark at the top and…

marketingserveruiv1.0.0

Preview

Share Image — live renderblocks-shareimage--default ↗

Rendered from the story the storybook (a11y) CI gate runs axe against — the preview can't show something that hasn't been verified.

Install

Two equivalent paths — the URL works in any shadcn-CLI setup; the alias works once you've registered @interlace in your components.json.

Via shadcn URL
npx shadcn@latest add https://ds.interlace.tools/r/share-image.json
With the @interlace alias
npx shadcn@latest add @interlace/share-image

History

This component is at v1.0.0, first shipped in @interlace/ui 2.0.0. The version is stamped as a banner into the file the install writes, so the copy in your tree says which one you have — compare it with the number above before deciding whether to re-run the install.

@interlace/ui 2.0.01 entry

  • Addedminor

    ShareImage: the picture a link unfurls into on X, LinkedIn, Facebook, WhatsApp, iMessage and Slack, as a tree Satori (Next's ImageResponse) paints, at 1200 × 630 or 1200 × 1200 (size="square"). A kicker, the title, a line of description, your mark and a label at the top, your address and a footnote at the foot, and one optional piece of evidence: a stat, up to five bars, or your own visual. The title steps down with its length and the room left, and the description is cut at a word. Image renderers cannot read CSS variables, so patterns/share-image-model reads your own theme file instead (themeFromCss: :root shadcn tokens, var() resolved, oklch() turned into hex), and shareMeta() writes the openGraph and twitter metadata with every image's size, type and alt. Satori has no bidi algorithm, so right-to-left text is broken into lines and put in drawing order before it sees it (visualRtlLine): Hebrew reads correctly, numbers and Latin runs keep their order, brackets mirror, and Arabic is shaped by the font engine (Cairo works; Noto Naskh Arabic throws in Satori). The card mirrors in right to left. A still: no motion.

Import

18 named exports — pull the parts you need.

Public API
import { NEUTRAL_SHARE_THEME, SHARE_IMAGE_SIZES, ShareImage, ShareImageSize, bidiRuns, breakLines, clampText, estimateLines, oklchToHex, planWords, readThemeTokens, shareMeta, shareThemeFromTokens, size, textDirection, themeFromCss, toPaintableColor, visualRtlLine } from '@/components/ui/patterns/share-image';

Anatomy

Extracted from the primitive's JSDoc header. The source is the only documentation that can't drift.

<div data-slot="share-image" data-size="og|square" dir>
    <div data-slot="share-image-edge" />                         (the accent rule)
    <div data-slot="share-image-head"> {brand} {label} </div>
    <div data-slot="share-image-body">
      <div data-slot="share-image-words"> kicker · title · description </div>
      <div data-slot="share-image-visual"> {stat | bars | visual} </div>
    </div>
    <div data-slot="share-image-foot"> {site} {footnote} </div>
  </div>

API reference

Parsed from the type declarations in the source — the same file the install writes into your tree, so this table can't drift from the component you get.

ShareImageProps

PropTypeDescription
title*stringThe page's title, the one thing everyone reads.
kickerstringA word or two above the title: the section, the kind of page.
descriptionstringOne sentence under the title. Cut at a word to fit.
brandReactNodeYour mark, top start. A string is set in the heading face.
labelstringA quiet tag, top end: "Answer", "Dataset", "Daily game".
sitestringThe address readers will see, foot start.
footnotestringFoot end: "6 sources", "Updated 24 Nov 2026".
stat{ value: stringA big number and what it counts.
barsShareImageBar[]Up to five bars; largest first reads best.
visualReactNodeYour own drawing in the evidence slot. Wins over `stat` and `bars`.
sizeShareImageSize—
themeShareImageTheme—
dir'ltr' | 'rtl' | 'auto'—

Accessibility

Every story for this component is rendered headlessly and checked with axe-core (wcag2aa, wcag22aa, best-practice, ACT) on every PR. That gate has no continue-on-error, so what ships has zero known violations.

What follows is what static analysis can see. Axe cannot press a key and never sees an overlay open, so the operable-without-a-mouse claim lives in Behavior instead, where the keyboard path is replayed step by step.

Focus + keyboard behaviour
Native element semantics — no interaction layer to get wrong.
Focus ring (WCAG 2.2 SC 2.4.13)
Not focusable — no focus indicator required.
Reduced motion
No animation to gate.
ARIA in the source
None — semantics come from the element or the Base UI primitive rather than hand-written ARIA.

Examples

4 more states from the same story file.

Dependencies

Base UI primitive
Native / no Base UI dependency
Lucide icons
none
NPM dependencies
none
Registry dependencies

Source

The full implementation — components/ui/patterns/share-image.tsx once installed.

475 lines · TypeScript
import type { CSSProperties, ReactNode } from 'react';

// @interlace/share-image v1.0.0 — Interlace design system.
// Docs, props and live preview: https://ds.interlace.tools/c/share-image
// What changed since: https://ds.interlace.tools/c/share-image#history
// Generated banner — keep it, the upgrade diff reads this version.

/**
 * @interlace/ui — ShareImage
 *
 * The picture a link unfurls into on X, LinkedIn, Facebook, WhatsApp,
 * iMessage and Slack: a kicker, the page's title, a line of description, and
 * one optional piece of evidence (a big number, a few bars, or anything you
 * draw), with your mark at the top and your address at the foot.
 *
 * ## Painted by an image renderer
 *
 * The tree uses only what Satori (Next's `ImageResponse`, `@vercel/og`)
 * paints: flex boxes and inline styles, no classes and no CSS variables. So
 * the theme arrives as a value, built once from your own theme file:

…455 more lines…

Registry JSON

The raw registry record — what the shadcn CLI fetches.