import_html_replica
Import HTML pages or replica specs into Figma as native frames, extracting layout and computed styles via headless Chromium.
Instructions
Import an HTML page or a replica spec into Figma as native frames via the plugin bridge. Give it an HTML file (htmlPath) or URL (htmlUrl) and it extracts layout + computed styles with headless Chromium, then rebuilds: main frame → section frames → nested containers / text / image nodes with absolute positions, border-radius, borders, shadows, gradients, and real image bytes. Alternatively pass a ready-made spec (spec/specPath, from get_html_replica_spec or hand-written). All degradations (missing fonts, SVG assets, failed images) are reported in the warnings array. Supports dryRun to preview the command plan.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Main frame landing X on the canvas (default 0). | |
| y | No | Main frame landing Y on the canvas (default 0). | |
| spec | No | Inline spec JSON. | |
| scale | No | ||
| dryRun | No | Return the command plan without executing. | |
| htmlUrl | No | http(s) URL to extract and import (mutually exclusive with spec/specPath/htmlPath). | |
| htmlPath | No | Path to a local .html file to extract and import (mutually exclusive with spec/specPath/htmlUrl). | |
| parentId | No | Target parent node id (default: current page). | |
| specPath | No | Path to a replica spec JSON. | |
| timeoutMs | No | Bridge timeout for the whole batch (default 120000). | |
| outSpecPath | No | Write the extracted spec JSON to this path for inspection. | |
| rootSelector | No | Extraction root element (default body). | |
| includeImages | No | Download asset bytes and insert real images (default true). | |
| mainFrameName | No | ||
| maxImageBytes | No | Per-image byte cap (default 5MB). | |
| viewportWidth | No | Extraction viewport width (default 1440). | |
| viewportHeight | No | Extraction viewport height (default 900). | |
| sectionSelector | No | Split the page into one section per matched element. | |
| skipEmptyFrames | No | Drop leaf frames with no visual style (default: keep as transparent containers). |