HTML & CSS → Figma

网页内容,在 Figma 编辑。

将网页转换为可编辑图层。支持文字、图片和 SVG。

npm install html2figma
转换示例
01网页HTML + CSS
02转为 JSON捕获的图层

正在加载预览…

点击图层,在网页中定位。

正在加载预览…

编辑案例 ↗
03
在 Figma 生成图层

在插件中粘贴 JSON。

插件指引 ↗

转换细节

网页如何变成图层。

查看网页、图层与对应的 JSON。

网页输入
网页输入

渲染 HTML 与 CSS。

在浏览器中渲染真实的 HTML 与 CSS 案例。

<p class="kicker">SMALL PARTS. NEW POSSIBILITIES.</p>
    <h2>Made to stay editable.</h2>
    <p class="copy">
      Bring text, shapes and vector details into a canvas you can keep working on.
    </p>

正在准备真实案例…

试试这个案例

接入你的项目。

浏览器调用 convert,Figma 插件调用 render。

Browser→JSON→ Figma
阅读集成指引 →
01 / BROWSERconvert API ↗
import { convert } from 'html2figma/convert';

await document.fonts.ready;
const documentAst = convert(document.body);
02 / FIGMA PLUGINrender API ↗
import { render } from 'html2figma/render';

await render(documentAst, {
  parent: figma.currentPage
});
查看文档格式与公共类型 →

把结果带进 Figma。

复制 JSON,粘贴到插件,即可生成图层。