@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.- Vanilla HTML
- React
- Vue 3
- Svelte 5
- Angular
Point a If you’d rather install via npm and bundle the script yourself, use the
<script> tag at the IIFE bundle on a CDN. The script is side-effecting. It registers <stackone-hub> on customElements.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:
- Vanilla HTML
- React
- Vue 3
- Svelte 5
- Angular
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 thetheme attribute to light or dark:
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:
- Vanilla HTML
- Angular
Events
Callbacks are dispatched as native DOMCustomEvents 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 HTTP (RPC).
Getting Started
Return to the end-to-end embedding journey.