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…
Preview
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.
npx shadcn@latest add https://ds.interlace.tools/r/share-image.jsonnpx shadcn@latest add @interlace/share-imageHistory
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'sImageResponse) 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: astat, up to fivebars, or your ownvisual. 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, sopatterns/share-image-modelreads your own theme file instead (themeFromCss::rootshadcn tokens,var()resolved,oklch()turned into hex), andshareMeta()writes theopenGraphandtwittermetadata 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.
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
| Prop | Type | Description |
|---|---|---|
| title* | string | The page's title, the one thing everyone reads. |
| kicker | string | A word or two above the title: the section, the kind of page. |
| description | string | One sentence under the title. Cut at a word to fit. |
| brand | ReactNode | Your mark, top start. A string is set in the heading face. |
| label | string | A quiet tag, top end: "Answer", "Dataset", "Daily game". |
| site | string | The address readers will see, foot start. |
| footnote | string | Foot end: "6 sources", "Updated 24 Nov 2026". |
| stat | { value: string | A big number and what it counts. |
| bars | ShareImageBar[] | Up to five bars; largest first reads best. |
| visual | ReactNode | Your own drawing in the evidence slot. Wins over `stat` and `bars`. |
| size | ShareImageSize | — |
| theme | ShareImageTheme | — |
| 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.
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.