This guide explains how to add a custom element extension to your new Wix CLI project as part of migrating an app from the legacy Wix CLI.
| Legacy | New |
|---|---|
src/site/widgets/custom-elements/<name>/element.json | src/extensions/site/widgets/<name>/<name>.extension.ts |
src/site/widgets/custom-elements/<name>/element.tsx | src/extensions/site/widgets/<name>/<name>.tsx |
src/site/widgets/custom-elements/<name>/panel.tsx | src/extensions/site/widgets/<name>/<name>.panel.tsx |
src/site/widgets/custom-elements/<name>/plugin.module.css | src/extensions/site/widgets/<name>/<name>.module.css |
Note: The custom-elements/ wrapper directory is removed in the new structure. Files move up 1 level to src/extensions/site/widgets/<name>/.
To move existing files into the new project:
src/extensions/site/widgets/<name>/.element.tsx → <name>.tsxpanel.tsx → <name>.panel.tsxplugin.module.css → <name>.module.css (if present).tsx files to use the new filenames..tsx files if needed, including imports of backend code.Don't copy the old element.json file. It is replaced by a new .extension.ts file.
In src/extensions/site/widgets/<name>/, create <name>.extension.ts:
| Field | Source | Required |
|---|---|---|
id | id from element.json | Yes. Must match legacy value to preserve the extension. |
name | name from element.json | Yes |
width | width from element.json. Use defaults if not set. | Yes |
height | height from element.json. Use defaults if not set. | Yes |
installation.autoAdd | installation.autoAddToSite or installation.autoAdd from element.json | Yes. Use false if not set. |
installation.essential | installation.essential from element.json | No |
presets | presets array from element.json | No |
tagName | Use the extension folder name | Yes |
element | Path to <name>.tsx, relative to src/ | Yes |
settings | Path to <name>.panel.tsx, relative to src/ | Yes |
Important:
The id must match the value from the legacy element.json. Otherwise, the new entry is treated as a separate extension instead of a continuation of the legacy one.
If the legacy element.json has presets with thumbnail URLs that reference a local assets/ folder, replace them with {{BASE_URL}}/thumbnail.png:
In the new project, in src/extensions.ts, import the extension and add it with .use():
Return to the Test, build, and release step in the main migration guide.
Last updated: 29 June 2026