How to add a dashboard builder to your app: the parts tutorials skip
I work on Datastripes, which sells the component used in the examples.
Dragging boxes on a grid is the visible part of a dashboard builder. The rest is what you maintain afterwards. I spent my previous years as a software engineer building reporting and BI for ERPs, and this is the checklist I would use before choosing how to build it.
Decide what your users can change
| Users need to | Reasonable option |
|---|---|
| See fixed charts | A charting library |
| Move and resize fixed widgets | A grid library such as react-grid-layout |
| Create their own widgets | A dashboard builder component, or your own |
| Query large or restricted data on a server | An embedded BI platform, or your own backend |
What "build it yourself" includes
- A grid with drag, resize and a mobile layout
- A widget editor: field, aggregation, chart type, filters
- A saved layout format, with validation and migrations
- Filtering, grouping and sorting
- Empty, error and loading states
- Exports, theming and number formats
Add the component
The example uses @datastripes/dashboard, which has entry points for React 19, Vue 3.4+, Angular 18 or 19, and a custom element.
npm install @datastripes/dashboard
import { useState } from 'react';
import { DatastripesDashboard } from '@datastripes/dashboard/react';
import { parseDashboardConfig, type DashboardConfig } from '@datastripes/dashboard';
const STORAGE_KEY = 'dashboard:v1';
function loadSaved(): DashboardConfig | undefined {
try {
const raw = localStorage.getItem(STORAGE_KEY);
return raw ? parseDashboardConfig(JSON.parse(raw)) : undefined;
} catch {
return undefined; // unreadable or outdated layout: start clean
}
}
export function UserDashboard({ rows, apiKey }: { rows: Record<string, unknown>[]; apiKey: string }) {
const [config, setConfig] = useState(loadSaved);
return (
<DatastripesDashboard
data={rows}
config={config}
mode="edit"
apiKey={apiKey}
autoGenerate={!config}
onChange={setConfig}
onSave={saved => localStorage.setItem(STORAGE_KEY, JSON.stringify(saved))}
/>
);
}
autoGenerate builds a first dashboard from the rows when there are no saved widgets. It needs a valid license.
Persist layouts properly
localStorage is enough for a prototype: the layout stays in one browser. In production, send the JSON to your backend and plan for these:
- Keys: store by user and by dashboard, and check ownership on the server.
- Validation: parse on load, as above. Treat stored JSON as untrusted input.
- Schema changes: if you rename a column in your data, saved widgets still point to the old name. Version your layouts and migrate them.
- Recovery: keep the last valid layout. The example falls back to an empty one, which a user may overwrite on the next save.
Client-side data changes your security model
The component computes in the browser, so you do not need a query backend. It also means every row you pass is available to the user, including rows hidden by a dashboard filter.
- Apply permissions in your API before the data reaches the page.
- Never pass sensitive columns "just in case".
- For large datasets, aggregate on the server first.
Measure the cost on your own data
In version 1.3.3, the standalone script build (dist/elements/index.global.js) is about 2.5 MB, or about 810 KB gzipped. A bundled React build will differ, so measure yours, and lazy-load the dashboard route.
Then test with your real row count on the slowest device you support. In-memory filtering has a limit that depends on columns, widgets and hardware, and a demo file will not show it.
Test the failure cases
- No license key, invalid key, or failed license request: the package falls back to the trial tier.
- Trial tier: 1,000 rows maximum, watermark, no auto-generation or data story.
localhostaccepts any non-empty key for development, so test licensing on a real domain before release.- Check how the grid behaves on a phone.
When not to use it
Choose something else if users must query data that cannot be sent to their browser, if you need server-side scheduled reports, or if an open-source-only stack is a requirement. This is a commercial package: a lifetime commercial license is €199 per domain at the time of writing.
Read next: Embed a dashboard builder in your web app · Dashboard widget