This package has been deprecated

Author message:

Package has been deprecated in favor of

TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published


This library has been deprecated in favor of

React Component Library

This is a React library for embedding dashboards in your React application.


npm i react-cumulio


yarn add react-cumulio


Add higher order context provider

This library makes use of the React state and context functionality.

More info about React context can be found here

Therefore all components that want to access the cumulio data and use the external actions, need to be wrapped in this context. All children in the App component will now have access to Cumulio data.

import React, { useReducer } from "react";
import {
} from "react-cumulio";

const [state, dispatch] = useReducer(reducer, initialState);

<CumulioContext.Provider value={{ state, dispatch }}>
    <App />

Use component

Render dashboard

The component can now be used and the state can be accessed. Include the component by:


OR render a single chart


Available Inputs
Below a list of available input options you can pass to the component. If you like, you can always take a look at the typescript definitions in the cumulio-model.ts file

dashboardId: string;                // The id of the dashboard you wish to embed.
chartId: string;                    // The id of the chart you wish to embed (Default: null)
authKey: string;                    // Authorization key generated via API (Default: null)
authToken: string;                  // Authorization token generated via API (Default: null)
language: string;                   // Sets the language of errors and loader, eg. 'en' (Default: 'auto')
screenmode: string;                 // Sets the screenmode of your dashboard: 'mobile', 'tablet', 'desktop', 'largeScreen', 'fixed' (Default: 'auto'). There is a ScreenMode enum available that can be used to simplify your code.
switchScreenmodeOnResize: boolean;  // true: the embedded dashboard can switch screenmodes on resize of the container , false: Dashboard will keep the same screenmode (Default: true)
loaderBackground: string;           // Background color of the loader element (Default: '#f9f9f9')
loaderFontColor: string;            // Font color of the text of the loaders (Default: '#5a5a5a')
loaderSpinnerColor: string;         // Spinner color of the loader (Default: 'rgba(255, 165, 0, 0.7)')
loaderSpinnerBackground: string;    // Background color of the spinner (Default: 'rgba(169, 169, 169, 0.14)')
loaderLogoColor: string;            // Background color of the spinner (Default: 'orange')
chartDimensions: Object;            // (optional) The desired dimensions of the single chart you want to embed; can be set when 'chartId' is set, chartDimensions : { width: 100, height: 200 }. (Default: { width: 'auto', height: 'auto' }) 


A dashboard with a gray loader background


A dashboard with a purple spinner color of the loader with screenmode mobile and switchScreenmodeOnResize on false, so that the dashboard will stay in mobile mode

import {
} from "react-cumulio";


Public methods that can be dispatched

There are a few methods that can be dispatched using the React state. This actions will execute a specific method on You can use the useCumulio() hook provided by the package. This hook will give you access to:

const { state, dispatch } = useCumulio();

The dispatch method allows a action to be passed.

const { state, dispatch } = useCumulio();

        chartId: "eb626f65-7c67-4cde-b365-d73c00bee0b7",
        dashboard: {
            dashboardId: "763177aa-9b93-4ae7-903e-3cb07dc593d8"

Dispatch the action and the data will be available inside the state variable.

The following state variables can be accessed.

dashboards: CumulioDashboard[];   // Returns an array of all the visible dashboards on a page with their information
filters: IDashboardFilters[];     // Returns an array of all visible dashboards with their active filters
data: object[];                   // Array with processed chart data
customEvent: any;                 // Returns the custom event information containing dashboard id, chart id and the event name & data

Possible actions and their parameters:

1. getDataAction

Returns an array the data of a chart of a certain dashboard by adding the dashboardId or the container of the iframe.

Properties that can be passed to the action.

interface IGetDataPayload {
    chartId: string;
    dashboard?: {
        dashboardId?: string;
        container?: string;

2. refreshDataAction

Refreshes the data of a specific chart when the id of that chart is supplied. Without a chartId this refreshes the data in all charts.

Properties that can be passed to the action.

interface IRefreshDataPayload {
    id?: string;

3. setAuthorizationAction

Changes the authorization of all or one dashboard and refreshes the data of those dashboards

Properties that can be passed to the action.

interface ISetAuthorizationPayload {
    authKey: string;
    authToken: string;
    dashboard?: {
        dashboardId?: string;
        container?: string;

4. exportDashboardAction

Exports the current dashboard as either pdf or png. A container class name needs to be passed as an argument and an optional format parameter.

Properties that can be passed to the action.

interface IExportDashboardPayload {
  container: string;
  format?: string;

5. reloadDashboardAction

Reloads the dashboard. (useful when the authorization is changed, and dashboard needs to be reloaded without reloading the iFrame).

5. getAccessibleDashboards

dispatch(await getAccessibleDashboards({ dashboardId?: string, dashboardSlug?: string, apiHost?: string, authKey?: string, authToken?: string, container?: string }));
// Get accessible dashboards in a integration, provide either dashboardId, dashboardSlug, container if a dashboard is already loaded.
// Or provide authKey, apiHost and authToken

// You will find integration inside state.integration

Quick links | Stackblitz Example

Package Sidebar


npm i react-cumulio

Weekly Downloads






Unpacked Size

1.05 MB

Total Files


Last publish


  • luzmoteam
  • cumul.io_team