Render React component
https:/api.basely.dev/render
Renders a React component as HTML or generates a PNG screenshot. Supports dynamic component loading and customizable rendering parameters.
Query parameters
pkg
string
Required
Package/module URL to import the component fromExamples:https://esm.sh/@basely/components component
string
Required
Component name to renderExamples:Baseline props
string
JSON string of props to pass to the componentExamples:{ "title": "Node.js Support", "toolGroups": [ [ {"tool":"bun","supported":true}, {"tool":"pnpm","supported":true}, {"tool":"npm","supported":true} ] ] } file
string
URL to a JSON file containing propsrender
enum
Set to "1" or "true" to return HTML instead of PNG1
string
true
string
font
string
Custom font URL (CSS)css
array of string
Custom CSS styles (can be specified multiple times)height
integer
Defaults: 800
Viewport height for screenshotRequired range:x >= 1 width
integer
Defaults: 468
Viewport width for screenshotRequired range:x >= 1
Response
Component rendered successfully
Example request
curl --request GET \ --url 'https://api.basely.dev/render?pkg=https%3A%2F%2Fesm.sh%2F%40basely%2Fcomponents&component=Baseline' \ --header 'accept: image/png'
Example response
"string"
Built with