Skip to Content
Addon DevelopmentAddonWidget component

AddonWidget component reference

AddonWidget is the mount root for third-party React trees. Your bundle should export default function Root(props).

Props

PropTypeDescription
addonIdstringManifest id
settingsRecord<string, unknown>Persisted user settings
updateSettings(patch) => Promise<void>Merge-update helper
theme'dark' | 'light'Mirror theme
localestringBCP-47 locale
httpM2C2HttpSigned fetch to core + addon proxy
piperPiperBridgeTTS/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

  1. Mount when user adds tile to layout.
  2. settings hydrate from disk before first paint.
  3. Unmount on layout removal — cancel timers in useEffect cleanups.

Troubleshooting

Styles leak
Scope CSS under .addon-root or use CSS modules — global selectors break core UI.

Last updated on

Was this helpful?