@stwd/react
Drop-in React components for building agent management UIs. Includes wallet overview, transaction history, policy controls, approval queues, and spend analytics — all wired to the Steward API with zero configuration.Install
Quick Start
Provider
<StewardProvider>
Wraps all other Steward components. Must be a parent of any component that uses Steward hooks or components.
| Prop | Type | Required | Description |
|---|---|---|---|
client | StewardClient | ✅ | Configured SDK client |
agentId | string | ✅ | Agent ID to scope all components to |
theme | ThemeOverrides | — | Override default CSS custom properties |
Components
<WalletOverview>
Displays the agent’s wallet address, on-chain balance, chain info, and optionally a funding QR code.
<TransactionHistory>
Paginated transaction history with status badges and blockchain explorer links.
signed / pending_approval / rejected / failed), and a link to the block explorer.
<PolicyControls>
Human-friendly policy management UI. Shows the current policy set with toggles, limits, and address lists.
spending-limit, approved-addresses, rate-limit, time-window, auto-approve-threshold. Respects the tenant’s policyExposure config — policies marked hidden or enforced are not shown.
<ApprovalQueue>
Shows pending transactions awaiting human review. Supports approve and deny actions.
<SpendDashboard>
Spend analytics for the agent with budget bars and summary numbers.
Hooks
All components are built on public hooks — use them directly for custom UIs.useSteward()
Access the Steward context: client, agentId, theme, and tenant config.
useWallet()
Agent identity and on-chain balance with auto-refresh.
useTransactions(opts?)
Paginated transaction history.
usePolicies()
Current policy set with CRUD operations.
useApprovals(interval?)
Pending approvals with approve/reject actions.
useSpend(range?)
Spend analytics for a time range.
Theming
Components use CSS custom properties scoped to.stwd-root. Override any --stwd-* variable in your stylesheet:
@stwd/react fetches it automatically from GET /tenants/:id/config and merges it with any prop overrides.
Tenant Control Plane Integration
If your Steward tenant has a control plane config configured,@stwd/react will automatically:
- Hide or lock policies marked as
hiddenorenforcedinpolicyExposure - Apply the tenant’s theme as base styles
- Show/hide features based on
featureFlags(e.g.,showFundingQR,showApprovalQueue) - Use policy templates from
policyTemplatesin the policy editor
Full Example
Peer Dependencies
react >= 18react-dom >= 18@stwd/sdk >= 0.3.0
Related
- SDK Client Reference — The underlying
StewardClientAPI - Tenant Config — Control plane for per-tenant theming + feature flags
- Approvals API — REST API for the approval workflow