Render React component

GET
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 from
    Examples:https://esm.sh/@basely/components
  • component
    string
    Required
    Component name to render
    Examples:Baseline
  • props
    string
    JSON string of props to pass to the component
    Examples:{ "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 props
  • render
    enum
    Set to "1" or "true" to return HTML instead of PNG
    • 1
      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 screenshot
    Required range: x >= 1
  • width
    integer
    Defaults: 468
    Viewport width for screenshot
    Required 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