AddonWidget component reference
AddonWidget is the mount root for third-party React trees. Your bundle should export default function Root(props).
Props
| Prop | Type | Description |
|---|---|---|
addonId | string | Manifest id |
settings | Record<string, unknown> | Persisted user settings |
updateSettings | (patch) => Promise<void> | Merge-update helper |
theme | 'dark' | 'light' | Mirror theme |
locale | string | BCP-47 locale |
http | M2C2Http | Signed fetch to core + addon proxy |
piper | PiperBridge | TTS/STT hooks when permitted |
Example skeleton
import type { AddonWidgetProps } from "@m2c2/sdk";
export default function CryptoAddon(props: AddonWidgetProps) {
const { settings, theme, http } = props;
return (
<div data-theme={theme} className="addon-root">
{/* your UI */}
</div>
);
}ℹ️ Note: Type import path @m2c2/sdk is illustrative — use the typings package version that matches your M2C2 install.
Lifecycle
- Mount when user adds tile to layout.
settingshydrate from disk before first paint.- Unmount on layout removal — cancel timers in
useEffectcleanups.
Troubleshooting
Styles leak
Scope CSS under .addon-root or use CSS modules — global selectors break core UI.
Last updated on
Was this helpful?