Skip to main content
@stackone/hub ships a framework-agnostic custom element, <stackone-hub>, that you can drop into any HTML page or framework template. React and ReactDOM are bundled into the web-component build, so consumers don’t need React installed. Use the web component for any non-React stack, or when you want a single code path across multiple frameworks. For a native React app, the StackOne Hub (Native) is usually a better fit. It integrates with your React tree and lets you pass callbacks as props.

Quick start

1

Install and register

Install the package and register <stackone-hub>. The import is side-effecting. It registers <stackone-hub> on customElements.
Point a <script> tag at the IIFE bundle on a CDN. The script is side-effecting. It registers <stackone-hub> on customElements.
If you’d rather install via npm and bundle the script yourself, use the import '@stackone/hub/webcomponent' pattern shown in the other tabs.
2

Get a session token from your backend

The Hub needs a connect session token to communicate with StackOne. Generate it server-side to keep your API key off the client.
To route the session through a specific connector profile (when a provider has more than one), pass its connector_profile_id when creating the session. See Target a specific connector profile.
3

Mount and wire the Hub

Mount the element, set the token, and listen for events:
4

Let users link their accounts

Your end-users now use the Hub to connect their accounts. Each successful link fires the success event with the linked account id — persist against your user — it’s the account ID you’ll use with every action call.You can also capture it server-side from the account.created webhook event.

Attributes

The <stackone-hub> element accepts these attributes. All scalar StackOneHub properties map to kebab-case HTML attributes:

Style Customization

Set the theme attribute to light or dark:
For custom theming, pass a PartialMalachiteTheme. Because HTML attributes are strings, use JSON.stringify(...) to encode the object first. The theme attribute receives a JSON-encoded PartialMalachiteTheme string, not an object:
See the @stackone/hub repository for full theme options.

Events

Callbacks are dispatched as native DOM CustomEvents on the host element with bubbles: true and composed: true.
Framework-emitted event shorthands behave differently from native DOM CustomEvents. React’s onSuccess={...} and Vue’s @event do not fire on them. Subscribe with addEventListener via a ref. Svelte’s on:event and Angular’s (event) do fire on them.

Next steps

Call Actions

With the account linked, call its actions from your product over the Agent SDK, MCP, A2A, or RPC/HTTP.

Embed Overview

Return to the end-to-end embedding journey.