Skip to main content
@vendoai/ui exposes headless React hooks that read from the same wire the built-in chrome uses. Pair them with your own UI when you need a bespoke surface, or drop them next to VendoOverlay to power an inline widget.

Uniform result shape

Every read hook returns the same four fields, so you can render loading, error, and empty states with one pattern across the whole surface.
isLoading is true only for the first fetch. Subsequent refresh() calls and background polls do not flip it back to true, so a spinner shown on first mount does not flash on every update. Read error to render a retry affordance without losing the last good data.

Available hooks

Hooks that write (approve, revoke, enable, disable) return an execute callback alongside the same { data, error, isLoading } fields, where isLoading reflects the in-flight mutation.

Polling

Pass pollMs to any read hook to keep the value fresh without a manual refresh. Polls are serialized per hook: an in-flight request finishes before the next tick starts, so a slow server never stacks up requests. When the tab is hidden, polling pauses; it resumes on focus.
Omit pollMs for a one-shot fetch on mount. Call refresh() from a websocket message, a mutation callback, or a button when you want to invalidate on your own schedule.

Threads

useThreads reads the same thread summaries VendoOverlay uses, so you can build a custom conversation list without giving up parity with the shipped chrome.
Pair with useVendoThread(threadId) to drive the streaming turn for the selected conversation.

Apps export and import

useApps exposes export(appId) and import(bytes) alongside the read fields so a custom apps drawer can round-trip an AppDocument through the wire without hand-rolling calls to /apps/:id/export and /apps/import.
Import mints a fresh app_ id and does not carry over data, grants, or authority — see Generated UI and apps for the ownership model.

When to use hooks vs. chrome

  • Reach for VendoOverlay and the other chrome components when you want the shipped surface with brand tokens applied.
  • Reach for hooks when you need to place counts, badges, or lists inside your own layout, or when your chrome needs to react to Vendo state without rendering the overlay at all.
Both paths speak the same wire, so mixing them in one app is safe.