createCodeFile

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 settings:

    • editViaPlugin — When true, the "Edit Code" UI action will open the plugin which has created the code file.

Returns: Promise<CodeFile> — The newly created code file instance.