Vanilla JS / Web Components

No framework at all: a <datastripes-dashboard> custom element, usable from a plain <script> tag.

Via a script tag

html
<script src="https://unpkg.com/@datastripes/dashboard/dist/elements/index.global.js"></script>

<datastripes-dashboard id="dash" mode="edit" api-key="..."></datastripes-dashboard>

<script>
  const el = document.getElementById('dash');
  el.data = myRows;          // set as a property for large datasets
  el.config = myConfig;      // DashboardConfig object
  el.addEventListener('ds-change', e => console.log(e.detail));
  el.addEventListener('ds-action', e => console.log(e.detail)); // row_click, filter_change
</script>

Via npm

ts
import '@datastripes/dashboard/elements'; // self-registers <datastripes-dashboard>

Attributes & properties

NameFormNotes
dataattribute (JSON) or propertyUse the property for datasets too large to serialize as an attribute
configattribute (JSON) or propertyValidated with safeParseDashboardConfig; invalid JSON logs a warning and is ignored
modeattribute or property"view" | "edit"
api-keyattribute, or apiKey propertyChecked via checkLicense() whenever set

Events

Lower-level: mountDashboard()

The custom element is a thin wrapper around the same mountDashboard() function used internally by Vue and Angular. Call it directly against any DOM element if you don't want a custom element at all:

ts
import { DashboardStore, JsQueryEngine, mountDashboard } from '@datastripes/dashboard';

const store = new DashboardStore({ config, data: rows, engine: new JsQueryEngine() });
const renderer = mountDashboard(document.getElementById('app'), { store, data: rows, mode: 'view' });

// later:
renderer.destroy();