Recipes
Common patterns and real-world examples.
Persist canvas to localStorage
Use the usePersistence hook to save and restore the canvas layout automatically.
Export canvas as JSON
Add a toolbar button that downloads the current canvas state.
Bind a chart to live Arrow data
Wire a chart widget to your server-side Arrow endpoint so it auto-refreshes.
Then reference the endpoint in your widget definition:
Stream agent responses
Use the streaming API to show a real-time 'agent typing' indicator while the patch arrives.
Track canvas selection
React to widget selection changes using the useWidgetSelection hook.
Use OpenAI / Groq instead of Claude
The OpenAI integration is compatible with any OpenAI-spec API.
Create KPI cards programmatically
Build executive dashboard KPI cards with trend indicators, targets, and sparklines.
Add a gauge for SLA monitoring
Create semicircular gauges with color zones for real-time metric monitoring.
Create cross-filtering slicers
Add Power BI-style slicers that filter other widgets by region, date, or category.
Fetch live data with useDataSource
Wire any chart to a REST endpoint with auto-refresh. The hook handles fetching, parsing, column inference, and error states.
Build a toolbar with useDashboardActions
Use the useDashboardActions hook to add, remove, duplicate, and export widgets from a custom toolbar.
Subscribe to a widget with useWidget
React to changes on a specific widget β great for building detail panels or property editors.
Load a dashboard template
Import a pre-built template and apply it to an empty canvas. Great for onboarding flows.
Let the agent build a complete dashboard
Prompt the agent to analyze data and automatically create the right mix of widget types.