Skip to main content
ImageResponse lets you generate dynamic images using JSX and CSS. This is useful for social media images such as Open Graph images and Twitter cards.

Parameters

ReactElement
required
A React element (JSX) describing the image layout. Only a subset of CSS and HTML is supported.
ImageResponseOptions
Optional configuration:

Supported CSS

ImageResponse supports common CSS including:
  • Flexbox layout (display: flex)
  • Absolute positioning
  • Custom fonts
  • Text wrapping and centering
  • Nested images
Advanced layouts like CSS Grid (display: grid) are not supported. For a full list of supported properties, see Satori’s documentation.

Behavior

  • Uses @vercel/og, Satori, and Resvg to convert JSX/CSS into PNG.
  • Maximum bundle size is 500KB (includes JSX, CSS, fonts, images, and other assets).
  • Supported font formats: ttf, otf, woff. Prefer ttf or otf for faster parsing.

Examples

In a Route Handler

app/api/og/route.tsx

With opengraph-image.tsx

app/opengraph-image.tsx

With custom fonts

app/opengraph-image.tsx

Version history