Loading...
Loading...
Use when building interactive components for predefined slots in Wix business solutions. Triggers include site plugin, slot, Wix app integration, plugin explorer, business solution extension.
npx skill4agent add wix/skills wix-cli-site-pluginsrc/extensions/site/plugins/<plugin-name>/<plugin>.tsxHTMLElementobservedAttributes<plugin>.panel.tsxwidget.getProp/setProp<plugin>.extension.tsextensions.sitePlugin()src/extensions.tsnpx tsc --noEmitnpx wix buildnpx wix preview<plugin-name>.tsxHTMLElementobservedAttributesconnectedCallback()attributeChangedCallback()display-name<plugin-name>.panel.tsx@wix/editorwidget.getProp('kebab-case-name')widget.setProp('kebab-case-name', value)WixDesignSystemProvider > SidePanel > SidePanel.Content<plugin-name>.extension.tsHTMLElement// my-site-plugin.tsx
class MyElement extends HTMLElement {
static get observedAttributes() {
return ['display-name'];
}
constructor() {
super();
}
connectedCallback() {
this.render();
}
attributeChangedCallback() {
this.render();
}
render() {
const displayName = this.getAttribute('display-name') || "Your Plugin's Title";
this.innerHTML = `
<div style="font-size: 16px; padding: 16px; border: 1px solid #ccc; border-radius: 8px; margin: 16px;">
<h2>${displayName}</h2>
<hr />
<p>
This is a Site Plugin generated by Wix CLI.<br />
Edit your element's code to change this text.
</p>
</div>
`;
}
}
export default MyElement;HTMLElementobservedAttributesdisplay-namebg-colorconnectedCallback()attributeChangedCallback()this.getAttribute('attribute-name')// my-site-plugin.panel.tsx
import React, { type FC, useState, useEffect, useCallback } from 'react';
import { widget } from '@wix/editor';
import {
SidePanel,
WixDesignSystemProvider,
Input,
FormField,
} from '@wix/design-system';
import '@wix/design-system/styles.global.css';
const Panel: FC = () => {
const [displayName, setDisplayName] = useState<string>('');
useEffect(() => {
widget.getProp('display-name')
.then(displayName => setDisplayName(displayName || "Your Plugin's Title"))
.catch(error => console.error('Failed to fetch display-name:', error));
}, [setDisplayName]);
const handleDisplayNameChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
const newDisplayName = event.target.value;
setDisplayName(newDisplayName);
widget.setProp('display-name', newDisplayName);
}, [setDisplayName]);
return (
<WixDesignSystemProvider>
<SidePanel width="300" height="100vh">
<SidePanel.Content noPadding stretchVertically>
<SidePanel.Field>
<FormField label="Display Name">
<Input
type="text"
value={displayName}
onChange={handleDisplayNameChange}
aria-label="Display Name"
/>
</FormField>
</SidePanel.Field>
</SidePanel.Content>
</SidePanel>
</WixDesignSystemProvider>
);
};
export default Panel;widget.getProp()widget.setProp()"display-name"WixDesignSystemProvider > SidePanel > SidePanel.Content@wix/design-system@wix/design-system/styles.global.cssaria-label| File | Convention | Example |
|---|---|---|
| kebab-case | |
| kebab-case | |
| kebab-case | |
src/extensions/site/pluginssrc/extensions/site/plugins/
└── {plugin-name}/
├── {plugin-name}.tsx # Main plugin component (HTMLElement)
├── {plugin-name}.panel.tsx # Settings panel component
└── {plugin-name}.extension.ts # Extension registration
public/
└── {plugin-name}-logo.svg # Plugin logo (optional)| Topic | Reference |
|---|---|
| Complete Examples | EXAMPLES.md |
| Slots (App IDs, multiple placements, finding slots) | SLOTS.md |
| WDS Components | WDS-COMPONENTS.md |
// my-site-plugin.extension.ts
import { extensions } from '@wix/astro/builders';
export default extensions.sitePlugin({
id: '{{GENERATE_UUID}}',
name: 'My Site Plugin',
marketData: {
name: 'My Site Plugin',
description: 'Marketing Description',
logoUrl: '{{BASE_URL}}/my-site-plugin-logo.svg',
},
placements: [{
appDefinitionId: 'a0c68605-c2e7-4c8d-9ea1-767f9770e087',
widgetId: '6a25b678-53ec-4b37-a190-65fcd1ca1a63',
slotId: 'product-page-details-6',
}],
installation: { autoAdd: true },
tagName: 'my-site-plugin',
element: './extensions/site/plugins/my-site-plugin/my-site-plugin.tsx',
settings: './extensions/site/plugins/my-site-plugin/my-site-plugin.panel.tsx',
});idrandomUUID(){{GENERATE_UUID}}"95a28afd-7df1-4e09-9ec1-ce710b0389a0"| Property | Type | Description |
|---|---|---|
| string | Unique static UUID v4 (generate fresh) |
| string | Internal name for the plugin |
| string | Display name in plugin explorer and app dashboard |
| string | Description shown in plugin explorer and app dashboard |
| string | Path to logo file ( |
| array | Array of slot placements where plugin can be added |
| string | ID of the Wix app containing the slot |
| string | ID of the page containing the slot |
| string | ID of the specific slot |
| boolean | Whether to auto-add plugin to slots on app installation |
| string | HTML custom element tag (kebab-case, must contain a hyphen) |
| string | Relative path to plugin component |
| string | Relative path to settings panel component |
src/extensions.tslocalStoragesessionStorageviewMode()any@ts-ignore