Skip to main content

HTML Layer

The HTML layer renders HTML/CSS content or screenshots a URL as an image. This enables rich visual elements — TailwindCSS utility classes, Google Fonts, JavaScript libraries (GSAP, Lottie, Chart.js), complex layouts, gradients, shadows, and more.

Example

HTML Layer Example — branded hero graphic

{
"type": "image",
"config": {
"width": 1200,
"height": 630,
"layers": [
{
"type": "html",
"html": "<div style=\"width:100%;height:100%;background:linear-gradient(135deg,#0f172a,#1e293b);display:flex;align-items:center;justify-content:center;font-family:'Inter',sans-serif;\"><div style=\"text-align:center;\"><div style=\"display:flex;align-items:center;justify-content:center;gap:16px;margin-bottom:32px;\"><div style=\"width:56px;height:56px;background:linear-gradient(135deg,#6366f1,#8b5cf6);border-radius:14px;display:flex;align-items:center;justify-content:center;\"><span style=\"color:white;font-size:28px;font-weight:800;\">J</span></div><span style=\"color:white;font-size:36px;font-weight:700;letter-spacing:-0.5px;\">JsonCut</span></div><h1 style=\"color:#f1f5f9;font-size:52px;font-weight:800;letter-spacing:-1px;margin:0 0 16px 0;\">Create visuals from JSON</h1><p style=\"color:#94a3b8;font-size:22px;margin:0;\">Images &amp; Videos via API — powered by HTML, CSS, and JSON configs</p></div></div>",
"googleFonts": ["Inter"]
}
]
}
}

Inline HTML

Provide HTML content directly via the html property:

{
"type": "image",
"config": {
"width": 1200,
"height": 630,
"layers": [
{
"type": "html",
"html": "<div style='display:flex;align-items:center;justify-content:center;width:100%;height:100%;background:linear-gradient(135deg,#667eea,#764ba2);color:white;font-size:48px;font-weight:bold;'>Hello World</div>",
"width": 1200,
"height": 630
}
]
}
}

TailwindCSS Support

Enable the TailwindCSS CDN with tailwindcss: true:

{
"type": "html",
"html": "<div class='flex items-center justify-center w-full h-full bg-gradient-to-br from-indigo-500 to-purple-600'><h1 class='text-6xl font-bold text-white drop-shadow-lg'>TailwindCSS Works!</h1></div>",
"tailwindcss": true,
"width": 1200,
"height": 630
}

JavaScript Libraries

Set enableLibraries: true to unlock a curated set of JavaScript libraries. When enabled, you can use inline <script> tags to write code using the provided libraries.

Included Libraries

LibraryVersionGlobalUse Case
TailwindCSSPlay CDNUtility-first CSS framework
GSAP3.xgsapProfessional-grade animations & timelines
Lottie Web5.xlottieAfter Effects JSON animations
Chart.js4.xChartData visualizations (bar, line, pie, etc.)
Motion12.xMotionSpring physics, keyframe animations, stagger
Anime.js4.xanimeLightweight timeline & property animations
D3.js7.xd3Advanced data visualizations (maps, graphs, custom charts)
Lucide Icons1.xlucide1500+ open-source SVG icons

All libraries are loaded automatically — you do not need to add any <script src="..."> tags. Just use the global variable directly in your inline <script> code.

If you accidentally include a <script> tag that imports one of these libraries, it will be automatically removed to prevent loading the library twice.

Chart.js Example

{
"type": "html",
"html": "<canvas id='chart' style='width:100%;height:100%;'></canvas><script>new Chart(document.getElementById('chart'),{type:'doughnut',data:{labels:['Direct','Social','Organic','Referral'],datasets:[{data:[35,25,28,12],backgroundColor:['#6366f1','#ec4899','#10b981','#f59e0b']}]},options:{responsive:true,plugins:{legend:{labels:{color:'#fff',font:{size:16}}}}}})</script>",
"css": "body{background:#0f172a;display:flex;align-items:center;justify-content:center;}",
"enableLibraries": true,
"width": 1200,
"height": 630
}
info

enableLibraries: true also enables TailwindCSS automatically — you do not need to set tailwindcss: true separately.

What's Not Supported

The following are not available in HTML layers, even with enableLibraries: true:

  • Custom external scripts — only the built-in libraries listed above can be used
  • External network requests from JavaScript (e.g. fetch(), XMLHttpRequest)
  • WebSockets and WebRTC
  • Web Workers
  • Storage APIs (localStorage, sessionStorage, indexedDB)
  • 3D / WebGL libraries (e.g. Three.js)
  • Node.js / Server-side code

Google Fonts

Load Google Fonts by specifying font families:

{
"type": "html",
"html": "<div style='font-family:Inter,sans-serif;font-size:42px;padding:40px;'>Beautiful typography with Google Fonts</div>",
"googleFonts": ["Inter"],
"width": 800,
"height": 200
}

URL Screenshot

Screenshot an external webpage using the src property (HTTPS only):

{
"type": "html",
"src": "https://example.com",
"width": 1280,
"height": 720,
"wait": 2
}
caution

The html and src properties are mutually exclusive — use one or the other per layer.

Properties

PropertyTypeRequiredDefaultDescription
type"html"YesLayer type identifier
htmlstringOne of html/srcInline HTML snippet (max 100KB)
srcstringOne of html/srcURL to screenshot (HTTPS only, max 2048 chars)
cssstringNoAdditional CSS styles (max 50KB)
tailwindcssbooleanNofalseEnable TailwindCSS CDN
googleFontsstring[]NoGoogle Font families to load (max 10)
waitnumberNo0Seconds to wait before screenshot (0-5)
enableLibrariesbooleanNofalseEnable JS libraries (GSAP, Lottie, Chart.js, TailwindCSS)
xnumberNo0X position in pixels
ynumberNo0Y position in pixels
widthnumberNocanvas widthRender width in pixels
heightnumberNocanvas heightRender height in pixels
positionstring/objectNoPosition preset or relative coordinates
opacitynumberNo1Transparency (0-1)
rotationnumberNo0Rotation in degrees
blurnumberNoBlur radius in pixels

Custom CSS

Provide additional CSS via the css property for finer layout control:

{
"type": "html",
"html": "<div class='card'><h1>Sales Report</h1><p>Q4 2024 Results</p></div>",
"css": ".card { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:100%; background:#1a1a2e; color:#e94560; font-family:sans-serif; } h1 { font-size:48px; margin-bottom:12px; } p { font-size:24px; color:#aaa; }",
"width": 800,
"height": 400
}

Limits

HTML layers have specific size and rendering constraints. See the Rate Limits & Tokens page for the full list.