import { OgCard } from "@pixxl-tools/components";
// In Server Components:
import { OgCard } from "@pixxl-tools/components/server";| Prop | Type | Default | Description |
|---|---|---|---|
siteName (required) | string | — | Site name next to the mark. |
title (required) | string | — | Page title; the size steps down for longer titles (up to three lines). |
accent | AccentPresetName | blue | Accent preset of the site (the accent bar); default blue. |
description | string | — | Up to two lines under the title (cut with an ellipsis after that). |
eyebrow | string | — | Short label above the title, in capitals and the accent text colour (one line), e.g. "Project", "Talk" or "Article". |
mark | ReactNode | string | — | The site mark at 64 px: an SVG string (the site's icon.svg, embedded as a data URL) or an element satori can draw. |
dir | "ltr" | "rtl" | — | rtl mirrors the layout for right-to-left titles. |
fontFamily | string | Geist | Font family of the card (default Geist, the font loadOgCardFonts() from @pixxl-tools/components/og loads). Glyphs it lacks fall back to the other fonts passed to the renderer. |
locale | string | — | BCP 47 tag of the text (lang on the root). |
siteNamerequiredstring
Site name next to the mark.
titlerequiredstring
Page title; the size steps down for longer titles (up to three lines).
accentdefault blueAccentPresetName
Accent preset of the site (the accent bar); default blue.
descriptionstring
Up to two lines under the title (cut with an ellipsis after that).
eyebrowstring
Short label above the title, in capitals and the accent text colour (one line), e.g. "Project", "Talk" or "Article".
markReactNode | string
The site mark at 64 px: an SVG string (the site's icon.svg, embedded as a data URL) or an element satori can draw.
dir"ltr" | "rtl"
rtl mirrors the layout for right-to-left titles.
fontFamilydefault Geiststring
Font family of the card (default Geist, the font loadOgCardFonts() from @pixxl-tools/components/og loads). Glyphs it lacks fall back to the other fonts passed to the renderer.
localestring
BCP 47 tag of the text (lang on the root).
// app/opengraph-image.tsx
import { ImageResponse } from "next/og";
import { OG_CARD_SIZE, OgCard, loadOgCardFonts } from "@pixxl-tools/components/og";
export const size = OG_CARD_SIZE;
export const contentType = "image/png";
// The site mark as an SVG string (or any element); currentColor takes the accent.
const iconSvg = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32"><circle cx="16" cy="16" r="14" fill="currentColor"/></svg>';
export default async function Image() {
return new ImageResponse(
<OgCard siteName="pixxl tools" eyebrow="Library" title="Components" description="Accessible React components." accent="teal" mark={iconSvg} />,
// Geist, plus fonts for scripts it lacks: [{ name: "Noto Sans JP", data, lang: "ja-JP" }]
{ ...size, fonts: await loadOgCardFonts() },
);
}