Skip to content

Open source · no build step

AI-generated dashboards, safe to embed

BI Components are HTML tags like <bar-chart>. Write a dashboard by hand, or let a language model write it for your users: it runs in a sandbox, on your data, with the rights of the person looking at it.

The playground: a conversation on the left, the dashboard it produced on the right


A dashboard is a few lines of HTML

This is the whole source of the dashboard below. It is live: click a bar to filter the rest, Ctrl / Cmd + click to select several.

<source-table name="orders" url="orders.csv" date-column="date"></source-table>

<score-card title="Revenue" table="orders" measure="sum(revenue)" format="eur"></score-card>
<score-card title="Orders" table="orders" measure="count(*)" format="int"></score-card>
<score-card title="Average order" table="orders" measure="avg(revenue)" format="eur"></score-card>

<bar-chart table="orders" measure="sum(revenue)" by="country" sort-by="sum(revenue) desc" format="eur"></bar-chart>
<line-chart table="orders" measure="sum(revenue)" by="date_trunc('month', date)" breakdown-by="channel" format="eur"></line-chart>

<script src="https://unytics.io/bi-components/dist/bi-components.js" defer></script>

No build step, no framework, nothing to install. The tags describe what to show; where the data comes from is a separate choice, and there are three.


Three ways to use it

The same tags work in three setups. Which one you need depends on who writes the dashboard and where the data is.

  • 1 · Static page

    You write the dashboard. The data is a file.

    The browser downloads a CSV, Parquet or JSON file and queries it locally with DuckDB-WASM. No backend at all.

    <source-table name="orders" url="orders.csv">
    

    For reports, documentation, static sites, prototypes. The dashboard above works this way.

    Guide · Example

  • 2 · Your backend

    You write the dashboard. The data stays on your server.

    The components send their queries to one endpoint of your API, which answers with the rights of the signed-in user.

    <source-api url="/api/queries">
    

    For the dashboards of your own product, on your own engine and access rules.

    Guide · Example

  • 3 · Sandbox

    A model or your users write the dashboard.

    Untrusted HTML runs in an isolated frame with no network access. Your application checks and answers every query.

    embedDashboard(element, { html, resolveQuery })
    

    For generative BI, "chat with your data", dashboards your customers build and share.

    Guide · Example

Compare the three setups and pick yours


Made for generated dashboards

Letting a model write what your users will run is first a security question. The third setup is where most of the work went.

  • A grammar a model gets right

    A dozen declarative tags and a handful of attributes. The system prompt that teaches them fits on one screen.

  • A sandbox for what it writes

    Generated HTML and JavaScript run in an isolated frame with no network access. They cannot read your application, its cookies or its tokens.

  • A semantic layer, or SQL expressions

    Give the model the names of your measures (revenue, margin_rate), or let it write SQL expressions on tables you expose. Either way your application checks every request before it runs.

  • The viewer's rights, always

    Every query is validated and answered by your application, which applies row-level security for the person looking at the dashboard, whoever wrote it.

  • Custom charts, contained

    When no component fits, the model writes a script with ECharts and the same data access as the components. It runs in the same sandbox.

  • Errors that correct themselves

    A refused query shows its reason in the component. Send that text back to the model and the next version is fixed.

The playground shows the result: a chat on the left, the dashboards it produced on the right, the HTML behind each of them, and a hostile dashboard being stopped. The Generative AI guide explains how to build it on your data.


Where to go next

  • Get started

    The three setups side by side, and a first dashboard in five minutes.

  • Components

    Every tag and its attributes, with live examples.

  • Examples

    Working pages for each setup, with their source.


Open source

BI Components is MIT licensed, on GitHub, and made by Unytics. It is built on Apache ECharts, DuckDB-WASM and standard Web Components.