2.0 alpha
These docs describe 2.0. Install it with @once-ui-system/core@alpha.
On 1.8.x? Read the 1.x docs
TrademarkTrademarkDocs
Ctrl k
Search docs...
Components

OgCard

Updated: May 9, 2025
View on GitHub
The OgCard component displays rich link previews for URLs by fetching and rendering Open Graph metadata. It's perfect for showcasing external links with preview images, titles, and descriptions. Instead of fetching Open Graph data from a URL, you can directly provide the data to display. The OgCard component supports different layout directions. The OgCard component supports different sizes. You can hide each element of the OgCard component by setting its prop value to false. The OgCard extends the Card component, so you can use all Card props to customize its appearance. To use OgCard with automatic Open Graph fetching, your application must expose the following API routes. These routes are used internally by the component to fetch metadata and safely load external assets. /api/og/fetch This endpoint retrieves Open Graph metadata (title, description, image, favicon) from a given URL. It is used when OgCard receives only a url prop. You can refer to the implementation in:
  • handleOGFetch.mdx
/api/og/proxy This endpoint proxies external images to avoid CORS restrictions when rendering preview images inside the card. You can refer to the implementation in:
  • handleOGProxy.mdx
/api/og/generate Used in advanced setups where OG images are dynamically generated server-side. This is optional depending on your configuration. Use serviceConfig to point OgCard at custom API routes or to transform proxied image and favicon URLs. Pass pre-fetched data with ogData to skip the fetch entirely.
Prop
Type
Default
url
The page to preview. Its Open Graph data is fetched and rendered.
string
sizes
The sizes attribute for the preview image.
string320px
unoptimized
Skip the framework image optimizer.
booleanfalse
size
Card scale.
lms
m
ogData
Supply the data yourself instead of fetching it.
Partial<OgData>null
direction
Image above the text, or beside it.
columnrowcolumn-reverserow-reverse
column
serviceConfig
Where to fetch the Open Graph data from.
OgServiceConfig{}
title
Override the fetched title, or false to hide it.
stringfalse
description
Override the fetched description, or false to hide it.
stringfalse
favicon
Override the fetched favicon, or false to hide it.
stringfalse
image
Override the fetched image, or false to hide it.
stringfalse
cardUrl
Override the displayed link text, or false to hide it.
stringfalse
…and every FlexProps propinherited
…and every CardProps propinherited
Prop
Type
Default
fetchOgUrl
Endpoint for fetching OG metadata.
string'/api/og/fetch'
proxyOgUrl
Endpoint for proxying external assets.
string'/api/og/proxy'
proxyImageUrl
Transform OG image URLs before rendering.
(url: string) => string
proxyFaviconUrl
Transform favicon URLs before rendering.
(url: string) => string
  • The component automatically fetches favicons for the domain
  • Images are proxied through an API endpoint to avoid CORS issues
  • You can overwrite the default props by providing static values
  • You can set any value to false to disable it
Edit this page on GitHub
TrademarkTrademark
Built with curiosity by Lorant One and the Design Engineers Club