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
pkgstringRequired
Package/module URL to import the component fromExamples:https://esm.sh/@basely/components componentstringRequired
Component name to renderExamples:Baseline propsstring
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} ] ] } filestring
URL to a JSON file containing propsrenderenum
Set to "1" or "true" to return HTML instead of PNG1string
truestring
fontstring
Custom font URL (CSS)cssarray of string
Custom CSS styles (can be specified multiple times)heightintegerDefaults: 800
Viewport height for screenshotRequired range:x >= 1 widthintegerDefaults: 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