Skip to Content

Framework Integration

Pick your framework

Embed a Databrain dashboard or metric in the framework your app uses.

@databrainhq/plugin gives you two custom elements: <dbn-dashboard> and <dbn-metric>. They work in any framework.

Before you start

Keep your data app API key on your backend. Never put it in browser code.

Rules for every framework

  • Install with npm install @databrainhq/plugin. npm also installs react and react-dom, which the plugin needs.
  • Import @databrainhq/plugin/web once, in browser code only. The import registers the elements.
  • Write attributes in kebab case: dashboard-id, metric-id, enable-download-csv.
  • Turn a boolean on with the value "true". A bare attribute reads as off.
  • Pass an object as a JSON string attribute, or as a JS property.
  • Set a function, such as handleServerEvent, as a JS property on the element. Assign an inline arrow function.
  • To show a different dashboard, remount the element. Each guide uses a key for this.

All props are in the component options reference.