AI 对话界面
代码编辑
代码变成画面:组件的用法逐字输入编辑器,语法颜色取自主题,最后一行输入完成后,右侧预览区显示结果。
安装
npx @imgcli/cli add code-edit使用
import { CodeEdit } from "@/components/imgcli/code-edit";
<CodeEdit />默认参数下以 30 fps 渲染 150 帧(5 秒),预览画布为 960 × 540。
Use <CodeEdit fileName="opening.tsx" code={snippet} previewText="the video." /> for 150 frames at 30 fps (CODE_EDIT_SECONDS). perChar sets the typing speed; the code uses Geist Mono.
| 参数 | 类型 | 默认值 | 说明 |
|---|---|---|---|
fileName | string | "opening.tsx" | |
code | string | DEFAULT_CODE | |
previewText | string | "the video." | Shown in the preview pane once the code is written. |
perChar | number | 0.014 | Seconds per character while typing. |
fontFamily | string | — | A face from the Imgcli font list, or any loaded CSS font stack. |
accentColor | string | — | |
theme | Partial<ImgcliTheme> | — | |
mode | "light" | "dark" | — | |
speed | number | 1 |
许可
MIT 许可,可免费用于个人及商业项目,保留版权和许可声明。
Copyright (c) 2026 Ricky (Imgcli) <https://imgcli.com>
常见问题
如何在 Remotion 项目中使用代码编辑?
运行 npx @imgcli/cli add code-edit。CLI 会把组件源码复制到项目的 components/imgcli/ 目录并安装依赖,之后可以直接修改源码。
代码编辑能做什么?
代码变成画面:组件的用法逐字输入编辑器,语法颜色取自主题,最后一行输入完成后,右侧预览区显示结果。
使用代码编辑前需要准备什么?
准备 Node.js 20.19 或更高版本,以及一个 Remotion 项目。新项目可以用 npx create-video@latest 创建。免费组件采用 MIT 许可证。