createCodeFile

createCodeFile

Create a new code file in the project.

const newFile = await framer.createCodeFile(
  "MyComponent",
  `export default function MyComponent() {
    return <div>Hello World</div>
  }`
)

Parameters

  • name: string – The name of the code file (including extension).

  • code: string – The initial content of the code file.

  • options: { editViaPlugin?: boolean; } (optional) – Optional settings. editViaPlugin: when true, the "Edit Code" UI action will open the plugin which created the code file.

Returns

  • Promise<CodeFile> – The newly created code file instance.